@itwin/core-backend 4.0.0-dev.10 → 4.0.0-dev.100

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 (270) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/lib/cjs/BackendHubAccess.d.ts +226 -224
  3. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  4. package/lib/cjs/BackendHubAccess.js +41 -41
  5. package/lib/cjs/BackendHubAccess.js.map +1 -1
  6. package/lib/cjs/BackendLoggerCategory.d.ts +90 -91
  7. package/lib/cjs/BackendLoggerCategory.d.ts.map +1 -1
  8. package/lib/cjs/BackendLoggerCategory.js +98 -99
  9. package/lib/cjs/BackendLoggerCategory.js.map +1 -1
  10. package/lib/cjs/BisCoreSchema.d.ts +21 -21
  11. package/lib/cjs/BisCoreSchema.js +60 -60
  12. package/lib/cjs/BlobContainerService.d.ts +120 -0
  13. package/lib/cjs/BlobContainerService.d.ts.map +1 -0
  14. package/lib/cjs/BlobContainerService.js +18 -0
  15. package/lib/cjs/BlobContainerService.js.map +1 -0
  16. package/lib/cjs/BriefcaseManager.d.ts +184 -170
  17. package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
  18. package/lib/cjs/BriefcaseManager.js +421 -414
  19. package/lib/cjs/BriefcaseManager.js.map +1 -1
  20. package/lib/cjs/Category.d.ts +153 -153
  21. package/lib/cjs/Category.js +243 -243
  22. package/lib/cjs/Category.js.map +1 -1
  23. package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
  24. package/lib/cjs/ChangeSummaryManager.js +444 -445
  25. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  26. package/lib/cjs/ChangedElementsDb.d.ts +99 -99
  27. package/lib/cjs/ChangedElementsDb.js +165 -165
  28. package/lib/cjs/ChangedElementsManager.d.ts +39 -39
  29. package/lib/cjs/ChangedElementsManager.js +88 -88
  30. package/lib/cjs/ChannelControl.d.ts +70 -0
  31. package/lib/cjs/ChannelControl.d.ts.map +1 -0
  32. package/lib/cjs/ChannelControl.js +89 -0
  33. package/lib/cjs/ChannelControl.js.map +1 -0
  34. package/lib/cjs/CheckpointManager.d.ts +121 -121
  35. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  36. package/lib/cjs/CheckpointManager.js +351 -349
  37. package/lib/cjs/CheckpointManager.js.map +1 -1
  38. package/lib/cjs/ClassRegistry.d.ts +79 -79
  39. package/lib/cjs/ClassRegistry.js +249 -245
  40. package/lib/cjs/ClassRegistry.js.map +1 -1
  41. package/lib/cjs/CloudSqlite.d.ts +572 -350
  42. package/lib/cjs/CloudSqlite.d.ts.map +1 -1
  43. package/lib/cjs/CloudSqlite.js +374 -153
  44. package/lib/cjs/CloudSqlite.js.map +1 -1
  45. package/lib/cjs/CodeService.d.ts +399 -396
  46. package/lib/cjs/CodeService.d.ts.map +1 -1
  47. package/lib/cjs/CodeService.js +63 -63
  48. package/lib/cjs/CodeService.js.map +1 -1
  49. package/lib/cjs/CodeSpecs.d.ts +58 -55
  50. package/lib/cjs/CodeSpecs.d.ts.map +1 -1
  51. package/lib/cjs/CodeSpecs.js +154 -124
  52. package/lib/cjs/CodeSpecs.js.map +1 -1
  53. package/lib/cjs/ConcurrentQuery.d.ts +13 -13
  54. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  55. package/lib/cjs/ConcurrentQuery.js +36 -36
  56. package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
  57. package/lib/cjs/CustomViewState3dCreator.d.ts.map +1 -1
  58. package/lib/cjs/CustomViewState3dCreator.js +80 -81
  59. package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
  60. package/lib/cjs/DevTools.d.ts +74 -71
  61. package/lib/cjs/DevTools.d.ts.map +1 -1
  62. package/lib/cjs/DevTools.js +156 -154
  63. package/lib/cjs/DevTools.js.map +1 -1
  64. package/lib/cjs/DisplayStyle.d.ts +104 -106
  65. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  66. package/lib/cjs/DisplayStyle.js +251 -256
  67. package/lib/cjs/DisplayStyle.js.map +1 -1
  68. package/lib/cjs/ECDb.d.ts +194 -191
  69. package/lib/cjs/ECDb.d.ts.map +1 -1
  70. package/lib/cjs/ECDb.js +351 -350
  71. package/lib/cjs/ECDb.js.map +1 -1
  72. package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
  73. package/lib/cjs/ECSchemaXmlContext.d.ts.map +1 -1
  74. package/lib/cjs/ECSchemaXmlContext.js +41 -41
  75. package/lib/cjs/ECSqlStatement.d.ts +473 -473
  76. package/lib/cjs/ECSqlStatement.js +791 -791
  77. package/lib/cjs/Element.d.ts +1105 -1109
  78. package/lib/cjs/Element.d.ts.map +1 -1
  79. package/lib/cjs/Element.js +1416 -1427
  80. package/lib/cjs/Element.js.map +1 -1
  81. package/lib/cjs/ElementAspect.d.ts +175 -179
  82. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  83. package/lib/cjs/ElementAspect.js +202 -211
  84. package/lib/cjs/ElementAspect.js.map +1 -1
  85. package/lib/cjs/ElementGraphics.d.ts +9 -9
  86. package/lib/cjs/ElementGraphics.js +41 -41
  87. package/lib/cjs/ElementGraphics.js.map +1 -1
  88. package/lib/cjs/ElementTreeWalker.d.ts +162 -162
  89. package/lib/cjs/ElementTreeWalker.d.ts.map +1 -1
  90. package/lib/cjs/ElementTreeWalker.js +409 -409
  91. package/lib/cjs/ElementTreeWalker.js.map +1 -1
  92. package/lib/cjs/Entity.d.ts +102 -106
  93. package/lib/cjs/Entity.d.ts.map +1 -1
  94. package/lib/cjs/Entity.js +118 -134
  95. package/lib/cjs/Entity.js.map +1 -1
  96. package/lib/cjs/EntityReferences.d.ts +49 -49
  97. package/lib/cjs/EntityReferences.d.ts.map +1 -1
  98. package/lib/cjs/EntityReferences.js +95 -95
  99. package/lib/cjs/ExportGraphics.d.ts +317 -317
  100. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  101. package/lib/cjs/ExportGraphics.js +208 -208
  102. package/lib/cjs/ExternalSource.d.ts +95 -96
  103. package/lib/cjs/ExternalSource.d.ts.map +1 -1
  104. package/lib/cjs/ExternalSource.js +130 -131
  105. package/lib/cjs/ExternalSource.js.map +1 -1
  106. package/lib/cjs/GeoCoordConfig.d.ts +19 -19
  107. package/lib/cjs/GeoCoordConfig.js +85 -85
  108. package/lib/cjs/GeoCoordConfig.js.map +1 -1
  109. package/lib/cjs/GeometrySummary.d.ts +4 -4
  110. package/lib/cjs/GeometrySummary.js +333 -333
  111. package/lib/cjs/GeometrySummary.js.map +1 -1
  112. package/lib/cjs/HubMock.d.ts +94 -94
  113. package/lib/cjs/HubMock.js +220 -222
  114. package/lib/cjs/HubMock.js.map +1 -1
  115. package/lib/cjs/IModelCloneContext.d.ts +8 -8
  116. package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
  117. package/lib/cjs/IModelCloneContext.js +15 -15
  118. package/lib/cjs/IModelDb.d.ts +1222 -1196
  119. package/lib/cjs/IModelDb.d.ts.map +1 -1
  120. package/lib/cjs/IModelDb.js +2389 -2392
  121. package/lib/cjs/IModelDb.js.map +1 -1
  122. package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
  123. package/lib/cjs/IModelElementCloneContext.js +159 -159
  124. package/lib/cjs/IModelHost.d.ts +370 -369
  125. package/lib/cjs/IModelHost.d.ts.map +1 -1
  126. package/lib/cjs/IModelHost.js +476 -496
  127. package/lib/cjs/IModelHost.js.map +1 -1
  128. package/lib/cjs/IModelJsFs.d.ts +62 -62
  129. package/lib/cjs/IModelJsFs.js +139 -140
  130. package/lib/cjs/IModelJsFs.js.map +1 -1
  131. package/lib/cjs/IpcHost.d.ts +104 -104
  132. package/lib/cjs/IpcHost.js +276 -278
  133. package/lib/cjs/IpcHost.js.map +1 -1
  134. package/lib/cjs/LineStyle.d.ts +311 -311
  135. package/lib/cjs/LineStyle.js +295 -295
  136. package/lib/cjs/LocalHub.d.ts +162 -162
  137. package/lib/cjs/LocalHub.d.ts.map +1 -1
  138. package/lib/cjs/LocalHub.js +579 -584
  139. package/lib/cjs/LocalHub.js.map +1 -1
  140. package/lib/cjs/LocalhostIpcHost.d.ts +21 -20
  141. package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -1
  142. package/lib/cjs/LocalhostIpcHost.js +79 -81
  143. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  144. package/lib/cjs/Material.d.ts +131 -131
  145. package/lib/cjs/Material.d.ts.map +1 -1
  146. package/lib/cjs/Material.js +185 -181
  147. package/lib/cjs/Material.js.map +1 -1
  148. package/lib/cjs/Model.d.ts +391 -392
  149. package/lib/cjs/Model.d.ts.map +1 -1
  150. package/lib/cjs/Model.js +487 -485
  151. package/lib/cjs/Model.js.map +1 -1
  152. package/lib/cjs/NativeAppStorage.d.ts +51 -51
  153. package/lib/cjs/NativeAppStorage.js +202 -202
  154. package/lib/cjs/NativeAppStorage.js.map +1 -1
  155. package/lib/cjs/NativeHost.d.ts +52 -52
  156. package/lib/cjs/NativeHost.d.ts.map +1 -1
  157. package/lib/cjs/NativeHost.js +158 -163
  158. package/lib/cjs/NativeHost.js.map +1 -1
  159. package/lib/cjs/NavigationRelationship.d.ts +156 -156
  160. package/lib/cjs/NavigationRelationship.js +225 -225
  161. package/lib/cjs/NavigationRelationship.js.map +1 -1
  162. package/lib/cjs/PromiseMemoizer.d.ts +51 -51
  163. package/lib/cjs/PromiseMemoizer.d.ts.map +1 -1
  164. package/lib/cjs/PromiseMemoizer.js +101 -101
  165. package/lib/cjs/PromiseMemoizer.js.map +1 -1
  166. package/lib/cjs/PropertyStore.d.ts +123 -132
  167. package/lib/cjs/PropertyStore.d.ts.map +1 -1
  168. package/lib/cjs/PropertyStore.js +179 -11
  169. package/lib/cjs/PropertyStore.js.map +1 -1
  170. package/lib/cjs/Relationship.d.ts +413 -416
  171. package/lib/cjs/Relationship.d.ts.map +1 -1
  172. package/lib/cjs/Relationship.js +491 -494
  173. package/lib/cjs/Relationship.js.map +1 -1
  174. package/lib/cjs/RpcBackend.d.ts +5 -5
  175. package/lib/cjs/RpcBackend.js +32 -32
  176. package/lib/cjs/SQLiteDb.d.ts +317 -219
  177. package/lib/cjs/SQLiteDb.d.ts.map +1 -1
  178. package/lib/cjs/SQLiteDb.js +318 -214
  179. package/lib/cjs/SQLiteDb.js.map +1 -1
  180. package/lib/cjs/Schema.d.ts +55 -55
  181. package/lib/cjs/Schema.js +83 -83
  182. package/lib/cjs/Schema.js.map +1 -1
  183. package/lib/cjs/ServerBasedLocks.d.ts +57 -57
  184. package/lib/cjs/ServerBasedLocks.js +168 -168
  185. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  186. package/lib/cjs/SqliteStatement.d.ts +360 -360
  187. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  188. package/lib/cjs/SqliteStatement.js +586 -586
  189. package/lib/cjs/Texture.d.ts +58 -58
  190. package/lib/cjs/Texture.js +82 -82
  191. package/lib/cjs/Texture.js.map +1 -1
  192. package/lib/cjs/TileStorage.d.ts +44 -18
  193. package/lib/cjs/TileStorage.d.ts.map +1 -1
  194. package/lib/cjs/TileStorage.js +109 -90
  195. package/lib/cjs/TileStorage.js.map +1 -1
  196. package/lib/cjs/TxnManager.d.ts +202 -202
  197. package/lib/cjs/TxnManager.d.ts.map +1 -1
  198. package/lib/cjs/TxnManager.js +356 -356
  199. package/lib/cjs/TxnManager.js.map +1 -1
  200. package/lib/cjs/ViewDefinition.d.ts +429 -439
  201. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  202. package/lib/cjs/ViewDefinition.js +640 -646
  203. package/lib/cjs/ViewDefinition.js.map +1 -1
  204. package/lib/cjs/ViewStateHydrator.d.ts +13 -13
  205. package/lib/cjs/ViewStateHydrator.js +103 -103
  206. package/lib/cjs/core-backend.d.ts +181 -184
  207. package/lib/cjs/core-backend.d.ts.map +1 -1
  208. package/lib/cjs/core-backend.js +205 -204
  209. package/lib/cjs/core-backend.js.map +1 -1
  210. package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
  211. package/lib/cjs/domains/FunctionalElements.js +145 -145
  212. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  213. package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
  214. package/lib/cjs/domains/FunctionalSchema.d.ts.map +1 -1
  215. package/lib/cjs/domains/FunctionalSchema.js +39 -40
  216. package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
  217. package/lib/cjs/domains/GenericElements.d.ts +177 -177
  218. package/lib/cjs/domains/GenericElements.js +263 -263
  219. package/lib/cjs/domains/GenericSchema.d.ts +10 -10
  220. package/lib/cjs/domains/GenericSchema.js +28 -28
  221. package/lib/cjs/rpc/multipart.d.ts +11 -11
  222. package/lib/cjs/rpc/multipart.js +71 -71
  223. package/lib/cjs/rpc/tracing.d.ts +28 -28
  224. package/lib/cjs/rpc/tracing.js +73 -74
  225. package/lib/cjs/rpc/tracing.js.map +1 -1
  226. package/lib/cjs/rpc/web/logging.d.ts +9 -9
  227. package/lib/cjs/rpc/web/logging.js +43 -43
  228. package/lib/cjs/rpc/web/request.d.ts +6 -6
  229. package/lib/cjs/rpc/web/request.js +73 -74
  230. package/lib/cjs/rpc/web/request.js.map +1 -1
  231. package/lib/cjs/rpc/web/response.d.ts +6 -6
  232. package/lib/cjs/rpc/web/response.js +105 -106
  233. package/lib/cjs/rpc/web/response.js.map +1 -1
  234. package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
  235. package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
  236. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
  237. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +293 -294
  238. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  239. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +20 -22
  240. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
  241. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +193 -205
  242. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  243. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
  244. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +166 -168
  245. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  246. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
  247. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +42 -43
  248. package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
  249. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
  250. package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
  251. package/lib/cjs/workspace/Settings.d.ts +186 -186
  252. package/lib/cjs/workspace/Settings.d.ts.map +1 -1
  253. package/lib/cjs/workspace/Settings.js +155 -155
  254. package/lib/cjs/workspace/Settings.js.map +1 -1
  255. package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
  256. package/lib/cjs/workspace/SettingsSchemas.js +190 -191
  257. package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
  258. package/lib/cjs/workspace/Workspace.d.ts +411 -414
  259. package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
  260. package/lib/cjs/workspace/Workspace.js +521 -543
  261. package/lib/cjs/workspace/Workspace.js.map +1 -1
  262. package/package.json +25 -28
  263. package/lib/cjs/AliCloudStorageService.d.ts +0 -24
  264. package/lib/cjs/AliCloudStorageService.d.ts.map +0 -1
  265. package/lib/cjs/AliCloudStorageService.js +0 -72
  266. package/lib/cjs/AliCloudStorageService.js.map +0 -1
  267. package/lib/cjs/CloudStorageBackend.d.ts +0 -59
  268. package/lib/cjs/CloudStorageBackend.d.ts.map +0 -1
  269. package/lib/cjs/CloudStorageBackend.js +0 -174
  270. package/lib/cjs/CloudStorageBackend.js.map +0 -1
@@ -1,1428 +1,1417 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Elements
8
- */
9
- var _a, _b;
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.FolderLink = exports.UrlLink = exports.LinkElement = exports.GroupInformationElement = exports.SpatialLocationPartition = exports.PhysicalPartition = exports.LinkPartition = exports.InformationRecordPartition = exports.GraphicalPartition3d = exports.GroupInformationPartition = exports.DocumentPartition = exports.DefinitionPartition = exports.InformationPartitionElement = exports.TemplateRecipe2d = exports.GraphicalType2d = exports.TemplateRecipe3d = exports.SpatialLocationType = exports.PhysicalType = exports.RecipeDefinitionElement = exports.TypeDefinitionElement = exports.DefinitionGroup = exports.DefinitionContainer = exports.DefinitionSet = exports.DefinitionElement = exports.InformationRecordElement = exports.Sheet = exports.SheetTemplate = exports.SheetBorderTemplate = exports.SectionDrawing = exports.Drawing = exports.Document = exports.Subject = exports.InformationReferenceElement = exports.DriverBundleElement = exports.InformationContentElement = exports.SectionDrawingLocation = exports.VolumeElement = exports.SpatialLocationElement = exports.PhysicalElement = exports.SpatialElement = exports.TextAnnotation3d = exports.TextAnnotation2d = exports.DrawingGraphic = exports.AnnotationElement2d = exports.GraphicalElement2d = exports.GeometricElement2d = exports.GraphicalElement3d = exports.GeometricElement3d = exports.GeometricElement = exports.Element = void 0;
12
- exports.RenderTimeline = exports.LineStyle = exports.GeometryPart = exports.RoleElement = exports.EmbeddedFileLink = exports.RepositoryLink = void 0;
13
- const core_bentley_1 = require("@itwin/core-bentley");
14
- const core_common_1 = require("@itwin/core-common");
15
- const core_geometry_1 = require("@itwin/core-geometry");
16
- const Entity_1 = require("./Entity");
17
- const Model_1 = require("./Model");
18
- const NavigationRelationship_1 = require("./NavigationRelationship");
19
- /** Elements are the smallest individually identifiable building blocks for modeling the real world in an iModel.
20
- * Each element represents an entity in the real world. Sets of Elements (contained in [[Model]]s) are used to model
21
- * other Elements that represent larger scale real world entities. Using this recursive modeling strategy,
22
- * Elements can represent entities at any scale. Elements can represent physical things or abstract concepts
23
- * or simply be information records.
24
- *
25
- * Every Element has a 64-bit id (inherited from Entity) that uniquely identifies it within an iModel. Every Element also
26
- * has a "code" that identifies its meaning in the real world. Additionally, Elements may have a "federationGuid"
27
- * to hold a GUID, if the element was assigned that GUID by some other federated database. The iModel database enforces
28
- * uniqueness of id, code, and federationGuid.
29
- *
30
- * See:
31
- * * [Element Fundamentals]($docs/bis/guide/fundamentals/element-fundamentals.md)
32
- * * [Working with schemas and elements in TypeScript]($docs/learning/backend/SchemasAndElementsInTypeScript.md)
33
- * * [Creating elements]($docs/learning/backend/CreateElements.md)
34
- * @public
35
- */
36
- class Element extends Entity_1.Entity {
37
- /** constructor for Element.
38
- * @internal
39
- */
40
- constructor(props, iModel) {
41
- super(props, iModel);
42
- this.code = core_common_1.Code.fromJSON(props.code); // TODO: Validate props.code - don't silently fail if it is the wrong type
43
- this.model = core_common_1.RelatedElement.idFromJson(props.model);
44
- this.parent = core_common_1.RelatedElement.fromJSON(props.parent);
45
- this.federationGuid = props.federationGuid;
46
- this.userLabel = props.userLabel;
47
- this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy
48
- }
49
- /** @internal */
50
- static get className() { return "Element"; }
51
- /** @internal */
52
- static get protectedOperations() { return ["onInsert", "onUpdate", "onDelete"]; }
53
- /** Called before a new Element is inserted.
54
- * @note throw an exception to disallow the insert
55
- * @note If you override this method, you must call super.
56
- * @note `this` is the class of the Element to be inserted
57
- * @beta
58
- */
59
- static onInsert(arg) {
60
- var _c;
61
- const { iModel, props } = arg;
62
- iModel.locks.checkSharedLock(props.model, "model", "insert"); // inserting requires shared lock on model
63
- if (props.parent) // inserting requires shared lock on parent, if present
64
- iModel.locks.checkSharedLock(props.parent.id, "parent", "insert");
65
- (_c = iModel.codeService) === null || _c === void 0 ? void 0 : _c.verifyCode(arg);
66
- }
67
- /** Called after a new Element was inserted.
68
- * @note If you override this method, you must call super.
69
- * @note `this` is the class of the Element that was inserted
70
- * @beta
71
- */
72
- static onInserted(arg) {
73
- arg.iModel.locks.elementWasCreated(arg.id);
74
- }
75
- /** Called before an Element is updated.
76
- * @note throw an exception to disallow the update
77
- * @note If you override this method, you must call super.
78
- * @note `this` is the class of the Element to be updated
79
- * @beta
80
- */
81
- static onUpdate(arg) {
82
- var _c;
83
- arg.iModel.locks.checkExclusiveLock(arg.props.id, "element", "update"); // eslint-disable-line @typescript-eslint/no-non-null-assertion
84
- (_c = arg.iModel.codeService) === null || _c === void 0 ? void 0 : _c.verifyCode(arg);
85
- }
86
- /** Called after an Element was updated.
87
- * @note If you override this method, you must call super.
88
- * @note `this` is the class of the Element that was updated
89
- * @beta
90
- */
91
- static onUpdated(_arg) { }
92
- /** Called before an Element is deleted.
93
- * @note throw an exception to disallow the delete
94
- * @note If you override this method, you must call super.
95
- * @note `this` is the class of the Element to be deleted
96
- * @beta
97
- */
98
- static onDelete(arg) {
99
- arg.iModel.locks.checkExclusiveLock(arg.id, "element", "delete");
100
- }
101
- /** Called after an Element was deleted.
102
- * @note If you override this method, you must call super.
103
- * @note `this` is the class of the Element that was deleted
104
- * @beta
105
- */
106
- static onDeleted(_arg) { }
107
- /** Called when an element with an instance of this class as its parent is about to be deleted.
108
- * @note throw an exception if the element should not be deleted
109
- * @note implementers should not presume that the element was deleted if this method does not throw,
110
- * since the delete may fail for other reasons. Instead, rely on [[onChildDeleted]] for that purpose.
111
- * @note `this` is the class of the parent Element whose child will be deleted
112
- * @beta
113
- */
114
- static onChildDelete(_arg) { }
115
- /** Called after an element with an instance of this class as its parent was successfully deleted.
116
- * @note `this` is the class of the parent Element whose child was deleted
117
- * @beta
118
- */
119
- static onChildDeleted(_arg) { }
120
- /** Called when a *new element* with an instance of this class as its parent is about to be inserted.
121
- * @note throw an exception if the element should not be inserted
122
- * @note `this` is the class of the prospective parent Element.
123
- * @beta
124
- */
125
- static onChildInsert(_arg) { }
126
- /** Called after a *new element* with an instance of this class as its parent was inserted.
127
- * @note `this` is the class of the parent Element.
128
- * @beta
129
- */
130
- static onChildInserted(_arg) { }
131
- /** Called when an element with an instance of this class as its parent is about to be updated.
132
- * @note throw an exception if the element should not be updated
133
- * @note `this` is the class of the parent Element.
134
- * @beta
135
- */
136
- static onChildUpdate(_arg) { }
137
- /** Called after an element with an instance of this the class as its parent was updated.
138
- * @note `this` is the class of the parent Element.
139
- * @beta
140
- */
141
- static onChildUpdated(_arg) { }
142
- /** Called when an *existing element* is about to be updated so that an instance of this class will become its new parent.
143
- * @note throw an exception if the element should not be added
144
- * @note `this` is the class of the prospective parent Element.
145
- * @beta
146
- */
147
- static onChildAdd(_arg) { }
148
- /** Called after an *existing element* has been updated so that an instance of this class is its new parent.
149
- * @note `this` is the class of the new parent Element.
150
- * @beta
151
- */
152
- static onChildAdded(_arg) { }
153
- /** Called when an element with an instance of this class as its parent is about to be updated change to a different parent.
154
- * @note throw an exception if the element should not be dropped
155
- * @note `this` is the class of the parent Element.
156
- * @beta
157
- */
158
- static onChildDrop(_arg) { }
159
- /** Called after an element with an instance of this class as its previous parent was updated to have a new parent.
160
- * @note `this` is the class of the previous parent Element.
161
- * @beta
162
- */
163
- static onChildDropped(_arg) { }
164
- /** Called when an instance of this class is being *sub-modeled* by a new Model.
165
- * @note throw an exception if model should not be inserted
166
- * @note `this` is the class of Element to be sub-modeled.
167
- * @beta
168
- */
169
- static onSubModelInsert(_arg) { }
170
- /** Called after an instance of this class was *sub-modeled* by a new Model.
171
- * @note `this` is the class of Element that is now sub-modeled.
172
- * @beta
173
- */
174
- static onSubModelInserted(_arg) { }
175
- /** Called when a sub-model of an instance of this class is being deleted.
176
- * @note throw an exception if model should not be deleted
177
- * @note `this` is the class of Element that is sub-modeled.
178
- * @beta
179
- */
180
- static onSubModelDelete(_arg) { }
181
- /** Called after a sub-model of an instance of this class was deleted.
182
- * @note `this` is the class of Element that was sub-modeled.
183
- * @beta
184
- */
185
- static onSubModelDeleted(_arg) { }
186
- /** Called during the iModel transformation process after an Element from the source iModel was *cloned* for the target iModel.
187
- * The transformation process automatically handles remapping BisCore properties and those that are properly described in ECSchema.
188
- * This callback is only meant to be overridden if there are other Ids in non-standard locations that need to be remapped or other data that needs to be fixed up after the clone.
189
- * @param _context The context that persists any remapping between the source iModel and target iModel.
190
- * @param _sourceProps The ElementProps for the source Element that was cloned.
191
- * @param _targetProps The ElementProps that are a result of the clone. These can be further modified.
192
- * @note If you override this method, you must call super.
193
- * @beta
194
- */
195
- static onCloned(_context, _sourceProps, _targetProps) { }
196
- /** Called when a *root* element in a subgraph is changed and before its outputs are processed.
197
- * This special callback is made when:
198
- * * the element is part of an [[ElementDrivesElement]] graph, and
199
- * * the element has no inputs, and
200
- * * none of the element's outputs have been processed.
201
- * @see [[ElementDrivesElement]] for more on element dependency graphs.
202
- * @beta
203
- */
204
- static onBeforeOutputsHandled(_id, _iModel) { }
205
- /** Called on an element in a graph after all of its inputs have been processed and before its outputs are processed.
206
- * This callback is made when:
207
- * * the specified element is part of an [[ElementDrivesElement]] graph, and
208
- * * there was a direct change to some element upstream in the dependency graph.
209
- * * all upstream elements in the graph have been processed.
210
- * * none of the downstream elements have been processed.
211
- * This method is not called if none of the element's inputs were changed.
212
- * @see [[ElementDrivesElement]] for more on element dependency graphs.
213
- * @beta
214
- */
215
- static onAllInputsHandled(_id, _iModel) { }
216
- /** Save this Element's properties to an object for serializing to JSON.
217
- * @internal
218
- */
219
- toJSON() {
220
- const val = super.toJSON();
221
- if (core_common_1.Code.isValid(this.code))
222
- val.code = this.code;
223
- val.model = this.model;
224
- if (undefined !== this.userLabel) // NOTE: blank string should be included in JSON
225
- val.userLabel = this.userLabel;
226
- if (this.federationGuid)
227
- val.federationGuid = this.federationGuid;
228
- if (this.parent)
229
- val.parent = this.parent;
230
- if (Object.keys(this.jsonProperties).length > 0)
231
- val.jsonProperties = this.jsonProperties;
232
- return val;
233
- }
234
- /** Collect the Ids of this element's *references* at this level of the class hierarchy.
235
- * @deprecated in 3.x. use [[collectReferenceIds]] instead, the use of the term *predecessors* was confusing and became inaccurate when the transformer could handle cycles
236
- * @beta
237
- */
238
- collectPredecessorIds(predecessorIds) {
239
- return this.collectReferenceIds(predecessorIds);
240
- }
241
- /** @internal */
242
- collectReferenceConcreteIds(referenceIds) {
243
- super.collectReferenceConcreteIds(referenceIds);
244
- referenceIds.addModel(this.model); // The modeledElement is a reference
245
- if (this.code.scope && core_bentley_1.Id64.isValidId64(this.code.scope))
246
- referenceIds.addElement(this.code.scope); // The element that scopes the code is a reference
247
- if (this.parent)
248
- referenceIds.addElement(this.parent.id); // A parent element is a reference
249
- }
250
- /** Get the Ids of this element's *references*. A *reference* is any element whose id is stored in the EC data of this element
251
- * This is important for cloning operations but can be useful in other situations as well.
252
- * @beta
253
- * @deprecated in 3.x. use [[getReferenceIds]] instead, the use of the term *predecessors* was confusing and became inaccurate when the transformer could handle cycles
254
- */
255
- getPredecessorIds() {
256
- return this.getReferenceIds();
257
- }
258
- /** Get the class metadata for this element. */
259
- getClassMetaData() { return this.iModel.classMetaDataRegistry.find(this.classFullName); }
260
- getAllUserProperties() {
261
- if (!this.jsonProperties.UserProps)
262
- this.jsonProperties.UserProps = new Object();
263
- return this.jsonProperties.UserProps;
264
- }
265
- /** Get a set of JSON user properties by namespace */
266
- getUserProperties(namespace) { return this.getAllUserProperties()[namespace]; }
267
- /** Change a set of user JSON properties of this Element by namespace. */
268
- setUserProperties(nameSpace, value) { this.getAllUserProperties()[nameSpace] = value; }
269
- /** Remove a set of JSON user properties, specified by namespace, from this Element */
270
- removeUserProperties(nameSpace) { delete this.getAllUserProperties()[nameSpace]; }
271
- /** Get a JSON property of this element, by namespace */
272
- getJsonProperty(nameSpace) { return this.jsonProperties[nameSpace]; }
273
- setJsonProperty(nameSpace, value) { this.jsonProperties[nameSpace] = value; }
274
- /** Get a display label for this Element. By default returns userLabel if present, otherwise code value. */
275
- getDisplayLabel() { var _c; return (_c = this.userLabel) !== null && _c !== void 0 ? _c : this.code.value; }
276
- /** Get a list of HTML strings that describe this Element for the tooltip. Strings will be listed on separate lines in the tooltip.
277
- * Any instances of the pattern `%{tag}` will be replaced by the localized value of tag.
278
- */
279
- getToolTipMessage() {
280
- const addKey = (key) => `<b>%{iModelJs:Element.${key}}:</b> `; // %{iModelJs:Element.xxx} is replaced with localized value of xxx in frontend.
281
- const msg = [];
282
- const display = this.getDisplayLabel();
283
- msg.push(display ? display : `${addKey("Id") + this.id}, ${addKey("Type")}${this.className}`);
284
- if (this instanceof GeometricElement)
285
- msg.push(addKey("Category") + this.iModel.elements.getElement(this.category).getDisplayLabel());
286
- msg.push(addKey("Model") + this.iModel.elements.getElement(this.model).getDisplayLabel());
287
- return msg;
288
- }
289
- /**
290
- * Insert this Element into the iModel.
291
- * @see [[IModelDb.Elements.insertElement]]
292
- * @note For convenience, the value of `this.id` is updated to reflect the resultant element's id.
293
- * However when `this.federationGuid` is not present or undefined, a new Guid will be generated and stored on the resultant element. But
294
- * the value of `this.federationGuid` is *not* updated. Generally, it is best to re-read the element after inserting (e.g. via [[IModelDb.Elements.getElement]])
295
- * if you intend to continue working with it. That will ensure its values reflect the persistent state.
296
- */
297
- insert() {
298
- return this.id = this.iModel.elements.insertElement(this.toJSON());
299
- }
300
- /** Update this Element in the iModel. */
301
- update() { this.iModel.elements.updateElement(this.toJSON()); }
302
- /** Delete this Element from the iModel. */
303
- delete() { this.iModel.elements.deleteElement(this.id); }
304
- }
305
- exports.Element = Element;
306
- /** A *required reference* is an element that had to be inserted before this element could have been inserted.
307
- * This is the list of property keys on this element that store references to those elements
308
- * @note This should be overridden (with `super` called) at each level of the class hierarchy that introduces required references.
309
- * @note any property listed here must be added to the reference ids in [[collectReferenceIds]]
310
- * @beta
311
- */
312
- Element.requiredReferenceKeys = ["parent", "model"];
313
- /** A map of every [[requiredReferenceKeys]] on this class to their entity type.
314
- * @note This should be overridden (with `super` called) at each level of the class hierarchy that introduces required references.
315
- * @alpha
316
- */
317
- Element.requiredReferenceKeyTypeMap = {
318
- parent: core_common_1.ConcreteEntityTypes.Element,
319
- model: core_common_1.ConcreteEntityTypes.Model,
320
- };
321
- /** An abstract base class to model real world entities that intrinsically have geometry.
322
- * @public
323
- */
324
- class GeometricElement extends (_b = Element) {
325
- /** @internal */
326
- constructor(props, iModel) {
327
- super(props, iModel);
328
- this.category = core_bentley_1.Id64.fromJSON(props.category);
329
- this.geom = props.geom;
330
- }
331
- /** @internal */
332
- static get className() { return "GeometricElement"; }
333
- /** Type guard for instanceof [[GeometricElement3d]] */
334
- is3d() { return this instanceof GeometricElement3d; }
335
- /** Type guard for instanceof [[GeometricElement2d]] */
336
- is2d() { return this instanceof GeometricElement2d; }
337
- /** Get the [Transform]($geometry) from the Placement of this GeometricElement */
338
- getPlacementTransform() { return this.placement.transform; }
339
- calculateRange3d() { return this.placement.calculateRange(); }
340
- /** Obtain the JSON representation of this element. */
341
- toJSON() {
342
- const val = super.toJSON();
343
- val.category = this.category;
344
- if (this.geom)
345
- val.geom = this.geom;
346
- return val;
347
- }
348
- /** @internal */
349
- collectReferenceConcreteIds(referenceIds) {
350
- super.collectReferenceConcreteIds(referenceIds);
351
- referenceIds.addElement(this.category);
352
- // TODO: GeometryPartIds?
353
- }
354
- }
355
- exports.GeometricElement = GeometricElement;
356
- _a = GeometricElement;
357
- /** @beta */
358
- GeometricElement.requiredReferenceKeys = [...Reflect.get(_b, "requiredReferenceKeys", _a), "category"];
359
- /** @alpha */
360
- GeometricElement.requiredReferenceKeyTypeMap = {
361
- ...Reflect.get(_b, "requiredReferenceKeyTypeMap", _a),
362
- category: core_common_1.ConcreteEntityTypes.Element,
363
- };
364
- /** An abstract base class to model real world entities that intrinsically have 3d geometry.
365
- * See [how to create a GeometricElement3d]($docs/learning/backend/CreateElements.md#GeometricElement3d).
366
- * @public
367
- */
368
- class GeometricElement3d extends GeometricElement {
369
- /** @internal */
370
- constructor(props, iModel) {
371
- super(props, iModel);
372
- this.placement = core_common_1.Placement3d.fromJSON(props.placement);
373
- if (props.typeDefinition)
374
- this.typeDefinition = core_common_1.TypeDefinition.fromJSON(props.typeDefinition);
375
- }
376
- /** @internal */
377
- static get className() { return "GeometricElement3d"; }
378
- /** @internal */
379
- toJSON() {
380
- const val = super.toJSON();
381
- val.placement = this.placement;
382
- if (undefined !== this.typeDefinition)
383
- val.typeDefinition = this.typeDefinition;
384
- return val;
385
- }
386
- /** @internal */
387
- collectReferenceConcreteIds(referenceIds) {
388
- super.collectReferenceConcreteIds(referenceIds);
389
- if (undefined !== this.typeDefinition)
390
- referenceIds.addElement(this.typeDefinition.id);
391
- }
392
- }
393
- exports.GeometricElement3d = GeometricElement3d;
394
- /** A 3d Graphical Element
395
- * @public
396
- */
397
- class GraphicalElement3d extends GeometricElement3d {
398
- /** @internal */
399
- static get className() { return "GraphicalElement3d"; }
400
- /** @internal */
401
- constructor(props, iModel) { super(props, iModel); }
402
- }
403
- exports.GraphicalElement3d = GraphicalElement3d;
404
- /** An abstract base class to model information entities that intrinsically have 2d geometry.
405
- * @public
406
- */
407
- class GeometricElement2d extends GeometricElement {
408
- /** @internal */
409
- constructor(props, iModel) {
410
- super(props, iModel);
411
- this.placement = core_common_1.Placement2d.fromJSON(props.placement);
412
- if (props.typeDefinition)
413
- this.typeDefinition = core_common_1.TypeDefinition.fromJSON(props.typeDefinition);
414
- }
415
- /** @internal */
416
- static get className() { return "GeometricElement2d"; }
417
- /** @internal */
418
- toJSON() {
419
- const val = super.toJSON();
420
- val.placement = this.placement;
421
- if (undefined !== this.typeDefinition)
422
- val.typeDefinition = this.typeDefinition;
423
- return val;
424
- }
425
- /** @internal */
426
- collectReferenceConcreteIds(referenceIds) {
427
- super.collectReferenceConcreteIds(referenceIds);
428
- if (undefined !== this.typeDefinition)
429
- referenceIds.addElement(this.typeDefinition.id);
430
- }
431
- }
432
- exports.GeometricElement2d = GeometricElement2d;
433
- /** An abstract base class for 2d Geometric Elements that are used to convey information within graphical presentations (like drawings).
434
- * @public
435
- */
436
- class GraphicalElement2d extends GeometricElement2d {
437
- /** @internal */
438
- static get className() { return "GraphicalElement2d"; }
439
- /** @internal */
440
- constructor(props, iModel) { super(props, iModel); }
441
- }
442
- exports.GraphicalElement2d = GraphicalElement2d;
443
- /** 2d element used to annotate drawings and sheets.
444
- * @public
445
- */
446
- class AnnotationElement2d extends GraphicalElement2d {
447
- /** @internal */
448
- static get className() { return "AnnotationElement2d"; }
449
- /** @internal */
450
- constructor(props, iModel) { super(props, iModel); }
451
- }
452
- exports.AnnotationElement2d = AnnotationElement2d;
453
- /** 2d element used to persist graphics for use in drawings.
454
- * @public
455
- */
456
- class DrawingGraphic extends GraphicalElement2d {
457
- /** @internal */
458
- static get className() { return "DrawingGraphic"; }
459
- /** @internal */
460
- constructor(props, iModel) { super(props, iModel); }
461
- }
462
- exports.DrawingGraphic = DrawingGraphic;
463
- /** 2D Text Annotation
464
- * @public
465
- */
466
- class TextAnnotation2d extends AnnotationElement2d {
467
- /** @internal */
468
- static get className() { return "TextAnnotation2d"; }
469
- /** @internal */
470
- constructor(props, iModel) { super(props, iModel); }
471
- }
472
- exports.TextAnnotation2d = TextAnnotation2d;
473
- /** 3D Text Annotation
474
- * @public
475
- */
476
- class TextAnnotation3d extends GraphicalElement3d {
477
- /** @internal */
478
- static get className() { return "TextAnnotation3d"; }
479
- /** @internal */
480
- constructor(props, iModel) { super(props, iModel); }
481
- }
482
- exports.TextAnnotation3d = TextAnnotation3d;
483
- /** An Element that occupies real world space. Its coordinates are in the project space of its iModel.
484
- * @public
485
- */
486
- class SpatialElement extends GeometricElement3d {
487
- /** @internal */
488
- static get className() { return "SpatialElement"; }
489
- /** @internal */
490
- constructor(props, iModel) { super(props, iModel); }
491
- }
492
- exports.SpatialElement = SpatialElement;
493
- /** An Element that is spatially located, has mass, and can be *touched*.
494
- * @public
495
- */
496
- class PhysicalElement extends SpatialElement {
497
- /** @internal */
498
- constructor(props, iModel) {
499
- super(props, iModel);
500
- this.physicalMaterial = core_common_1.RelatedElement.fromJSON(props.physicalMaterial);
501
- }
502
- /** @internal */
503
- static get className() { return "PhysicalElement"; }
504
- /** @internal */
505
- toJSON() {
506
- var _c;
507
- const val = super.toJSON();
508
- val.physicalMaterial = (_c = this.physicalMaterial) === null || _c === void 0 ? void 0 : _c.toJSON();
509
- return val;
510
- }
511
- }
512
- exports.PhysicalElement = PhysicalElement;
513
- /** Identifies a *tracked* real world location but has no mass and cannot be *touched*.
514
- * @public
515
- */
516
- class SpatialLocationElement extends SpatialElement {
517
- /** @internal */
518
- static get className() { return "SpatialLocationElement"; }
519
- /** @internal */
520
- constructor(props, iModel) { super(props, iModel); }
521
- }
522
- exports.SpatialLocationElement = SpatialLocationElement;
523
- /** A Volume Element is a Spatial Location Element that is restricted to defining a volume.
524
- * @public
525
- */
526
- class VolumeElement extends SpatialLocationElement {
527
- /** @internal */
528
- static get className() { return "VolumeElement"; }
529
- /** @internal */
530
- constructor(props, iModel) { super(props, iModel); }
531
- }
532
- exports.VolumeElement = VolumeElement;
533
- /** A SectionDrawingLocation element identifies the location of a [[SectionDrawing]] in the context of a [[SpatialModel]],
534
- * enabling [HyperModeling]($hypermodeling).
535
- * @note The associated ECClass was added to the BisCore schema in version 1.0.11.
536
- * @public
537
- */
538
- class SectionDrawingLocation extends SpatialLocationElement {
539
- constructor(props, iModel) {
540
- var _c;
541
- super(props, iModel);
542
- this.sectionView = (_c = core_common_1.RelatedElement.fromJSON(props.sectionView)) !== null && _c !== void 0 ? _c : core_common_1.RelatedElement.none;
543
- }
544
- /** @internal */
545
- static get className() { return "SectionDrawingLocation"; }
546
- /** @internal */
547
- toJSON() {
548
- return {
549
- ...super.toJSON(),
550
- sectionView: this.sectionView.toJSON(),
551
- };
552
- }
553
- }
554
- exports.SectionDrawingLocation = SectionDrawingLocation;
555
- /** Information Content Element is an abstract base class for modeling pure information entities. Only the
556
- * core framework should directly subclass from Information Content Element. Domain and application developers
557
- * should start with the most appropriate subclass of Information Content Element.
558
- * @public
559
- */
560
- class InformationContentElement extends Element {
561
- /** @internal */
562
- static get className() { return "InformationContentElement"; }
563
- /** @internal */
564
- constructor(props, iModel) { super(props, iModel); }
565
- }
566
- exports.InformationContentElement = InformationContentElement;
567
- /** Element used in conjunction with bis:ElementDrivesElement relationships to bundle multiple inputs before
568
- * driving the output element.
569
- * @beta
570
- */
571
- class DriverBundleElement extends InformationContentElement {
572
- /** @internal */
573
- static get className() { return "DriverBundleElement"; }
574
- /** @internal */
575
- constructor(props, iModel) { super(props, iModel); }
576
- }
577
- exports.DriverBundleElement = DriverBundleElement;
578
- /** Information Reference is an abstract base class for modeling entities whose main purpose is to reference something else.
579
- * @public
580
- */
581
- class InformationReferenceElement extends InformationContentElement {
582
- /** @internal */
583
- static get className() { return "InformationReferenceElement"; }
584
- /** @internal */
585
- constructor(props, iModel) { super(props, iModel); }
586
- }
587
- exports.InformationReferenceElement = InformationReferenceElement;
588
- /** A Subject is an information element that describes what this repository (or part thereof) is about.
589
- * See [how to create a Subject element]$(docs/learning/backend/CreateElements.md#Subject).
590
- * @public
591
- */
592
- class Subject extends InformationReferenceElement {
593
- /** @internal */
594
- constructor(props, iModel) { super(props, iModel); }
595
- /** @internal */
596
- static get className() { return "Subject"; }
597
- /** @internal */
598
- toJSON() {
599
- return super.toJSON(); // Entity.toJSON takes care of auto-handled properties
600
- }
601
- /** Create a Code for a Subject given a name that is meant to be unique within the scope of its parent Subject.
602
- * @param iModelDb The IModelDb
603
- * @param parentSubjectId The Id of the parent Subject that provides the scope for names of its child Subjects.
604
- * @param codeValue The child Subject name
605
- */
606
- static createCode(iModelDb, parentSubjectId, codeValue) {
607
- const codeSpec = iModelDb.codeSpecs.getByName(core_common_1.BisCodeSpec.subject);
608
- return new core_common_1.Code({ spec: codeSpec.id, scope: parentSubjectId, value: codeValue });
609
- }
610
- /** Create a Subject
611
- * @param iModelDb The IModelDb
612
- * @param parentSubjectId The new Subject will be a child of this Subject
613
- * @param name The name (codeValue) of the Subject
614
- * @param description The optional description of the Subject
615
- * @returns The newly constructed Subject
616
- * @throws [[IModelError]] if there is a problem creating the Subject
617
- */
618
- static create(iModelDb, parentSubjectId, name, description) {
619
- const subjectProps = {
620
- classFullName: this.classFullName,
621
- model: core_common_1.IModel.repositoryModelId,
622
- parent: new NavigationRelationship_1.SubjectOwnsSubjects(parentSubjectId),
623
- code: this.createCode(iModelDb, parentSubjectId, name),
624
- description,
625
- };
626
- return new Subject(subjectProps, iModelDb);
627
- }
628
- /** Insert a Subject
629
- * @param iModelDb Insert into this IModelDb
630
- * @param parentSubjectId The new Subject will be inserted as a child of this Subject
631
- * @param name The name (codeValue) of the Subject
632
- * @param description The optional description of the Subject
633
- * @returns The Id of the newly inserted Subject
634
- * @throws [[IModelError]] if there is a problem inserting the Subject
635
- */
636
- static insert(iModelDb, parentSubjectId, name, description) {
637
- const subject = this.create(iModelDb, parentSubjectId, name, description);
638
- return iModelDb.elements.insertElement(subject.toJSON());
639
- }
640
- }
641
- exports.Subject = Subject;
642
- /** An InformationContentElement that identifies the content of a document.
643
- * The realized form of a document is called a DocumentCarrier (different class than Document).
644
- * For example, a will is a legal document. The will published into a PDF file is an ElectronicDocumentCopy.
645
- * The will printed onto paper is a PrintedDocumentCopy.
646
- * In this example, the Document only identifies, names, and tracks the content of the will.
647
- * @public
648
- */
649
- class Document extends InformationContentElement {
650
- /** @internal */
651
- static get className() { return "Document"; }
652
- /** @internal */
653
- constructor(props, iModel) { super(props, iModel); }
654
- }
655
- exports.Document = Document;
656
- /** A document that represents a drawing, that is, a two-dimensional graphical representation of engineering data. A Drawing element is usually modelled by a [[DrawingModel]].
657
- * @public
658
- */
659
- class Drawing extends Document {
660
- /** @internal */
661
- static get className() { return "Drawing"; }
662
- /** @internal */
663
- constructor(props, iModel) { super(props, iModel); }
664
- /** Create a Code for a Drawing given a name that is meant to be unique within the scope of the specified DocumentListModel.
665
- * @param iModel The IModelDb
666
- * @param scopeModelId The Id of the DocumentListModel that contains the Drawing and provides the scope for its name.
667
- * @param codeValue The Drawing name
668
- */
669
- static createCode(iModel, scopeModelId, codeValue) {
670
- const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.drawing);
671
- return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
672
- }
673
- /** Insert a Drawing element and a DrawingModel that breaks it down.
674
- * @param iModelDb Insert into this iModel
675
- * @param documentListModelId Insert the new Drawing into this DocumentListModel
676
- * @param name The name of the Drawing.
677
- * @returns The Id of the newly inserted Drawing element and the DrawingModel that breaks it down (same value).
678
- * @throws [[IModelError]] if unable to insert the element.
679
- */
680
- static insert(iModelDb, documentListModelId, name) {
681
- const drawingProps = {
682
- classFullName: this.classFullName,
683
- model: documentListModelId,
684
- code: this.createCode(iModelDb, documentListModelId, name),
685
- };
686
- const drawingId = iModelDb.elements.insertElement(drawingProps);
687
- const model = iModelDb.models.createModel({
688
- classFullName: Model_1.DrawingModel.classFullName,
689
- modeledElement: { id: drawingId },
690
- });
691
- return iModelDb.models.insertModel(model.toJSON());
692
- }
693
- }
694
- exports.Drawing = Drawing;
695
- /** A document that represents a section drawing, that is, a graphical documentation derived from a planar
696
- * section of a spatial view. A SectionDrawing element is modelled by a [[SectionDrawingModel]] or a [[GraphicalModel3d]].
697
- * A [[SectionDrawingLocation]] can associate the drawing with a spatial location, enabling [HyperModeling]($hypermodeling).
698
- * @public
699
- */
700
- class SectionDrawing extends Drawing {
701
- /** @internal */
702
- constructor(props, iModel) {
703
- var _c, _d;
704
- super(props, iModel);
705
- this.sectionType = core_bentley_1.JsonUtils.asInt(props.sectionType, core_common_1.SectionType.Section);
706
- this.spatialView = (_c = core_common_1.RelatedElement.fromJSON(props.spatialView)) !== null && _c !== void 0 ? _c : core_common_1.RelatedElement.none;
707
- this.displaySpatialView = core_bentley_1.JsonUtils.asBool((_d = props.jsonProperties) === null || _d === void 0 ? void 0 : _d.displaySpatialView);
708
- const json = props.jsonProperties;
709
- if (!json)
710
- return;
711
- if (json.drawingToSpatialTransform)
712
- this.drawingToSpatialTransform = core_geometry_1.Transform.fromJSON(json.drawingToSpatialTransform);
713
- if (json.sheetToSpatialTransform)
714
- this.sheetToSpatialTransform = core_geometry_1.Transform.fromJSON(json.sheetToSpatialTransform);
715
- if (json.drawingBoundaryClip)
716
- this.drawingBoundaryClip = core_geometry_1.ClipVector.fromJSON(json.drawingBoundaryClip);
717
- }
718
- /** @internal */
719
- static get className() { return "SectionDrawing"; }
720
- /** Convert to JSON representation. */
721
- toJSON() {
722
- var _c, _d, _e;
723
- const props = {
724
- ...super.toJSON(),
725
- sectionType: this.sectionType,
726
- spatialView: this.spatialView.toJSON(),
727
- };
728
- if (!props.jsonProperties)
729
- props.jsonProperties = {};
730
- props.jsonProperties.displaySpatialView = this.displaySpatialView ? true : undefined;
731
- props.jsonProperties.drawingToSpatialTransform = (_c = this.drawingToSpatialTransform) === null || _c === void 0 ? void 0 : _c.toJSON();
732
- props.jsonProperties.sheetToSpatialTransform = (_d = this.sheetToSpatialTransform) === null || _d === void 0 ? void 0 : _d.toJSON();
733
- props.jsonProperties.drawingBoundaryClip = (_e = this.drawingBoundaryClip) === null || _e === void 0 ? void 0 : _e.toJSON();
734
- return props;
735
- }
736
- }
737
- exports.SectionDrawing = SectionDrawing;
738
- /** The template for a SheetBorder
739
- * @public
740
- */
741
- class SheetBorderTemplate extends Document {
742
- /** @internal */
743
- constructor(props, iModel) { super(props, iModel); }
744
- /** @internal */
745
- static get className() { return "SheetBorderTemplate"; }
746
- }
747
- exports.SheetBorderTemplate = SheetBorderTemplate;
748
- /** The template for a [[Sheet]]
749
- * @public
750
- */
751
- class SheetTemplate extends Document {
752
- /** @internal */
753
- constructor(props, iModel) { super(props, iModel); }
754
- /** @internal */
755
- static get className() { return "SheetTemplate"; }
756
- /** @internal */
757
- collectReferenceConcreteIds(referenceIds) {
758
- super.collectReferenceConcreteIds(referenceIds);
759
- if (undefined !== this.border)
760
- referenceIds.addElement(this.border);
761
- }
762
- }
763
- exports.SheetTemplate = SheetTemplate;
764
- /** A digital representation of a *sheet of paper*. Modeled by a [[SheetModel]].
765
- * @public
766
- */
767
- class Sheet extends Document {
768
- /** @internal */
769
- constructor(props, iModel) {
770
- super(props, iModel);
771
- this.height = core_bentley_1.JsonUtils.asDouble(props.height);
772
- this.width = core_bentley_1.JsonUtils.asDouble(props.width);
773
- this.scale = props.scale;
774
- this.sheetTemplate = props.sheetTemplate ? core_bentley_1.Id64.fromJSON(props.sheetTemplate) : undefined;
775
- }
776
- /** @internal */
777
- static get className() { return "Sheet"; }
778
- /** @internal */
779
- collectReferenceConcreteIds(referenceIds) {
780
- super.collectReferenceConcreteIds(referenceIds);
781
- if (undefined !== this.sheetTemplate)
782
- referenceIds.addElement(this.sheetTemplate);
783
- }
784
- /** Create a Code for a Sheet given a name that is meant to be unique within the scope of the specified DocumentListModel.
785
- * @param iModel The IModelDb
786
- * @param scopeModelId The Id of the DocumentListModel that contains the Sheet and provides the scope for its name.
787
- * @param codeValue The Sheet name
788
- */
789
- static createCode(iModel, scopeModelId, codeValue) {
790
- const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.sheet);
791
- return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
792
- }
793
- }
794
- exports.Sheet = Sheet;
795
- /** Information Record Element is an abstract base class for modeling information records. Information Record
796
- * Element is the default choice if no other subclass of Information Content Element makes sense.
797
- * @public
798
- */
799
- class InformationRecordElement extends InformationContentElement {
800
- /** @internal */
801
- static get className() { return "InformationRecordElement"; }
802
- /** @internal */
803
- constructor(props, iModel) { super(props, iModel); }
804
- }
805
- exports.InformationRecordElement = InformationRecordElement;
806
- /** A Definition Element holds configuration-related information that is meant to be referenced / shared.
807
- * @public
808
- */
809
- class DefinitionElement extends InformationContentElement {
810
- /** @internal */
811
- constructor(props, iModel) {
812
- super(props, iModel);
813
- this.isPrivate = true === props.isPrivate;
814
- }
815
- /** @internal */
816
- static get className() { return "DefinitionElement"; }
817
- /** @internal */
818
- toJSON() {
819
- const val = super.toJSON();
820
- val.isPrivate = this.isPrivate;
821
- return val;
822
- }
823
- }
824
- exports.DefinitionElement = DefinitionElement;
825
- /** This abstract class unifies DefinitionGroup and DefinitionContainer for relationship endpoint purposes.
826
- * @note The associated ECClass was added to the BisCore schema in version 1.0.10
827
- * @public
828
- */
829
- class DefinitionSet extends DefinitionElement {
830
- /** @internal */
831
- static get className() { return "DefinitionSet"; }
832
- }
833
- exports.DefinitionSet = DefinitionSet;
834
- /** A DefinitionContainer exclusively owns a set of DefinitionElements contained within its sub-model (of type DefinitionModel).
835
- * @note The associated ECClass was added to the BisCore schema in version 1.0.10
836
- * @public
837
- */
838
- class DefinitionContainer extends DefinitionSet {
839
- /** @internal */
840
- static get className() { return "DefinitionContainer"; }
841
- /** Create a DefinitionContainer
842
- * @param iModelDb The IModelDb
843
- * @param definitionModelId The Id of the [DefinitionModel]($backend) that will contain this DefinitionContainer element.
844
- * @param code The Code for this DefinitionContainer.
845
- * @param isPrivate The optional hint, that if `true` means it should not be displayed in the UI.
846
- * @returns The newly constructed DefinitionContainer
847
- * @note There is not a predefined CodeSpec for DefinitionContainer elements, so it is the responsibility of the domain or application to create one.
848
- * @throws [[IModelError]] if there is a problem creating the DefinitionContainer
849
- */
850
- static create(iModelDb, definitionModelId, code, isPrivate) {
851
- const elementProps = {
852
- classFullName: this.classFullName,
853
- model: definitionModelId,
854
- code,
855
- isPrivate,
856
- };
857
- return new DefinitionContainer(elementProps, iModelDb);
858
- }
859
- /** Insert a DefinitionContainer and its sub-model.
860
- * @param iModelDb Insert into this IModelDb
861
- * @param definitionModelId The Id of the [DefinitionModel]($backend) that will contain this DefinitionContainer element.
862
- * @param code The Code for this DefinitionContainer.
863
- * @param isPrivate The optional hint, that if `true` means it should not be displayed in the UI.
864
- * @returns The Id of the newly inserted DefinitionContainer and its newly inserted sub-model (of type DefinitionModel).
865
- * @note There is not a predefined CodeSpec for DefinitionContainer elements, so it is the responsibility of the domain or application to create one.
866
- * @throws [[IModelError]] if there is a problem inserting the DefinitionContainer
867
- */
868
- static insert(iModelDb, definitionModelId, code, isPrivate) {
869
- const containerElement = this.create(iModelDb, definitionModelId, code, isPrivate);
870
- const containerElementId = iModelDb.elements.insertElement(containerElement.toJSON());
871
- const containerSubModelProps = {
872
- classFullName: Model_1.DefinitionModel.classFullName,
873
- modeledElement: { id: containerElementId },
874
- isPrivate,
875
- };
876
- iModelDb.models.insertModel(containerSubModelProps);
877
- return containerElementId;
878
- }
879
- }
880
- exports.DefinitionContainer = DefinitionContainer;
881
- /** A non-exclusive set of DefinitionElements grouped using the DefinitionGroupGroupsDefinitions relationship.
882
- * @note The associated ECClass was added to the BisCore schema in version 1.0.10
883
- * @public
884
- */
885
- class DefinitionGroup extends DefinitionSet {
886
- /** @internal */
887
- static get className() { return "DefinitionGroup"; }
888
- /** Create a DefinitionGroup
889
- * @param iModelDb The IModelDb
890
- * @param definitionModelId The Id of the [DefinitionModel]($backend) that will contain this DefinitionGroup element.
891
- * @param code The Code for this DefinitionGroup
892
- * @param isPrivate The optional hint, that if `true` means it should not be displayed in the UI.
893
- * @returns The newly constructed DefinitionGroup
894
- * @note There is not a predefined CodeSpec for DefinitionGroup elements, so it is the responsibility of the domain or application to create one.
895
- * @throws [[IModelError]] if there is a problem creating the DefinitionGroup
896
- */
897
- static create(iModelDb, definitionModelId, code, isPrivate) {
898
- const elementProps = {
899
- classFullName: this.classFullName,
900
- model: definitionModelId,
901
- code,
902
- isPrivate,
903
- };
904
- return new DefinitionGroup(elementProps, iModelDb);
905
- }
906
- }
907
- exports.DefinitionGroup = DefinitionGroup;
908
- /** Defines a set of properties (the *type*) that may be associated with an element.
909
- * @public
910
- */
911
- class TypeDefinitionElement extends DefinitionElement {
912
- /** @internal */
913
- constructor(props, iModel) { super(props, iModel); }
914
- /** @internal */
915
- static get className() { return "TypeDefinitionElement"; }
916
- /** @internal */
917
- collectReferenceConcreteIds(referenceIds) {
918
- super.collectReferenceConcreteIds(referenceIds);
919
- if (undefined !== this.recipe)
920
- referenceIds.addElement(this.recipe.id);
921
- }
922
- }
923
- exports.TypeDefinitionElement = TypeDefinitionElement;
924
- /** Defines a recipe for generating instances from a definition.
925
- * @beta
926
- */
927
- class RecipeDefinitionElement extends DefinitionElement {
928
- /** @internal */
929
- static get className() { return "RecipeDefinitionElement"; }
930
- /** @internal */
931
- constructor(props, iModel) { super(props, iModel); }
932
- }
933
- exports.RecipeDefinitionElement = RecipeDefinitionElement;
934
- /** Defines a set of properties (the *type*) that can be associated with a Physical Element. A Physical
935
- * Type has a strong correlation with something that can be ordered from a catalog since all instances
936
- * share a common set of properties.
937
- * @public
938
- */
939
- class PhysicalType extends TypeDefinitionElement {
940
- /** @internal */
941
- constructor(props, iModel) {
942
- super(props, iModel);
943
- this.physicalMaterial = core_common_1.RelatedElement.fromJSON(props.physicalMaterial);
944
- }
945
- /** @internal */
946
- static get className() { return "PhysicalType"; }
947
- /** @internal */
948
- toJSON() {
949
- var _c;
950
- const val = super.toJSON();
951
- val.physicalMaterial = (_c = this.physicalMaterial) === null || _c === void 0 ? void 0 : _c.toJSON();
952
- return val;
953
- }
954
- /** Create a Code for a PhysicalType element given a name that is meant to be unique within the scope of the specified DefinitionModel.
955
- * @param iModel The IModelDb
956
- * @param scopeModelId The Id of the DefinitionModel that contains the PhysicalType element and provides the scope for its name.
957
- * @param codeValue The PhysicalType name
958
- */
959
- static createCode(iModel, scopeModelId, codeValue) {
960
- const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.physicalType);
961
- return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
962
- }
963
- }
964
- exports.PhysicalType = PhysicalType;
965
- /** Defines a set of properties (the *type*) that can be associated with a spatial location.
966
- * @public
967
- */
968
- class SpatialLocationType extends TypeDefinitionElement {
969
- /** @internal */
970
- static get className() { return "SpatialLocationType"; }
971
- /** @internal */
972
- constructor(props, iModel) { super(props, iModel); }
973
- /** Create a Code for a SpatialLocationType element given a name that is meant to be unique within the scope of the specified DefinitionModel.
974
- * @param iModel The IModelDb
975
- * @param scopeModelId The Id of the DefinitionModel that contains the SpatialLocationType element and provides the scope for its name.
976
- * @param codeValue The SpatialLocationType name
977
- */
978
- static createCode(iModel, scopeModelId, codeValue) {
979
- const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.spatialLocationType);
980
- return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
981
- }
982
- }
983
- exports.SpatialLocationType = SpatialLocationType;
984
- /** A TemplateRecipe3d is a DefinitionElement that has a sub-model that contains the 3d template elements.
985
- * @beta
986
- */
987
- class TemplateRecipe3d extends RecipeDefinitionElement {
988
- /** @internal */
989
- static get className() { return "TemplateRecipe3d"; }
990
- /** @internal */
991
- constructor(props, iModel) { super(props, iModel); }
992
- /** Create a Code for a TemplateRecipe3d given a name that is meant to be unique within the scope of its Model.
993
- * @param iModelDb The IModelDb
994
- * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe3d element.
995
- * @param codeValue The name of the TemplateRecipe3d element.
996
- */
997
- static createCode(iModelDb, definitionModelId, codeValue) {
998
- const codeSpec = iModelDb.codeSpecs.getByName(core_common_1.BisCodeSpec.templateRecipe3d);
999
- return new core_common_1.Code({ spec: codeSpec.id, scope: definitionModelId, value: codeValue });
1000
- }
1001
- /** Create a TemplateRecipe3d
1002
- * @param iModelDb The IModelDb
1003
- * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe3d element.
1004
- * @param name The name (Code.value) of the TemplateRecipe3d
1005
- * @returns The newly constructed TemplateRecipe3d
1006
- * @throws [[IModelError]] if there is a problem creating the TemplateRecipe3d
1007
- */
1008
- static create(iModelDb, definitionModelId, name, isPrivate) {
1009
- const elementProps = {
1010
- classFullName: this.classFullName,
1011
- model: definitionModelId,
1012
- code: this.createCode(iModelDb, definitionModelId, name),
1013
- isPrivate,
1014
- };
1015
- return new TemplateRecipe3d(elementProps, iModelDb);
1016
- }
1017
- /** Insert a TemplateRecipe3d and a PhysicalModel (sub-model) that will contain the 3d template elements.
1018
- * @param iModelDb The IModelDb
1019
- * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe3d element.
1020
- * @param name The name (Code.value) of the TemplateRecipe3d
1021
- * @returns The Id of the newly inserted TemplateRecipe3d and the PhysicalModel that sub-models it.
1022
- * @throws [[IModelError]] if there is a problem inserting the TemplateRecipe3d or its sub-model.
1023
- */
1024
- static insert(iModelDb, definitionModelId, name, isPrivate) {
1025
- const element = this.create(iModelDb, definitionModelId, name, isPrivate);
1026
- const modeledElementId = iModelDb.elements.insertElement(element.toJSON());
1027
- const modelProps = {
1028
- classFullName: Model_1.PhysicalModel.classFullName,
1029
- modeledElement: { id: modeledElementId },
1030
- isTemplate: true,
1031
- };
1032
- return iModelDb.models.insertModel(modelProps); // will be the same value as modeledElementId
1033
- }
1034
- }
1035
- exports.TemplateRecipe3d = TemplateRecipe3d;
1036
- /** Defines a set of properties (the *type*) that can be associated with a 2D Graphical Element.
1037
- * @public
1038
- */
1039
- class GraphicalType2d extends TypeDefinitionElement {
1040
- /** @internal */
1041
- static get className() { return "GraphicalType2d"; }
1042
- /** @internal */
1043
- constructor(props, iModel) { super(props, iModel); }
1044
- /** Create a Code for a GraphicalType2d element given a name that is meant to be unique within the scope of the specified DefinitionModel.
1045
- * @param iModel The IModelDb
1046
- * @param scopeModelId The Id of the DefinitionModel that contains the GraphicalType2d element and provides the scope for its name.
1047
- * @param codeValue The GraphicalType2d name
1048
- */
1049
- static createCode(iModel, scopeModelId, codeValue) {
1050
- const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.graphicalType2d);
1051
- return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
1052
- }
1053
- }
1054
- exports.GraphicalType2d = GraphicalType2d;
1055
- /** A recipe that uses a 2D template for creating new instances.
1056
- * @beta
1057
- */
1058
- class TemplateRecipe2d extends RecipeDefinitionElement {
1059
- /** @internal */
1060
- static get className() { return "TemplateRecipe2d"; }
1061
- /** @internal */
1062
- constructor(props, iModel) { super(props, iModel); }
1063
- /** Create a Code for a TemplateRecipe2d given a name that is meant to be unique within the scope of its Model.
1064
- * @param iModelDb The IModelDb
1065
- * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe2d element.
1066
- * @param codeValue The name of the TemplateRecipe2d element.
1067
- */
1068
- static createCode(iModelDb, definitionModelId, codeValue) {
1069
- const codeSpec = iModelDb.codeSpecs.getByName(core_common_1.BisCodeSpec.templateRecipe2d);
1070
- return new core_common_1.Code({ spec: codeSpec.id, scope: definitionModelId, value: codeValue });
1071
- }
1072
- /** Create a TemplateRecipe2d
1073
- * @param iModelDb The IModelDb
1074
- * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe2d element.
1075
- * @param name The name (Code.value) of the TemplateRecipe2d
1076
- * @returns The newly constructed TemplateRecipe2d
1077
- * @throws [[IModelError]] if there is a problem creating the TemplateRecipe2d
1078
- */
1079
- static create(iModelDb, definitionModelId, name, isPrivate) {
1080
- const elementProps = {
1081
- classFullName: this.classFullName,
1082
- model: definitionModelId,
1083
- code: this.createCode(iModelDb, definitionModelId, name),
1084
- isPrivate,
1085
- };
1086
- return new TemplateRecipe2d(elementProps, iModelDb);
1087
- }
1088
- /** Insert a TemplateRecipe2d and a DrawingModel (sub-model) that will contain the 2d template elements.
1089
- * @param iModelDb The IModelDb
1090
- * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe2d element.
1091
- * @param name The name (Code.value) of the TemplateRecipe2d
1092
- * @returns The Id of the newly inserted TemplateRecipe2d and the PhysicalModel that sub-models it.
1093
- * @throws [[IModelError]] if there is a problem inserting the TemplateRecipe2d or its sub-model.
1094
- */
1095
- static insert(iModelDb, definitionModelId, name, isPrivate) {
1096
- const element = this.create(iModelDb, definitionModelId, name, isPrivate);
1097
- const modeledElementId = iModelDb.elements.insertElement(element.toJSON());
1098
- const modelProps = {
1099
- classFullName: Model_1.DrawingModel.classFullName,
1100
- modeledElement: { id: modeledElementId },
1101
- isTemplate: true,
1102
- };
1103
- return iModelDb.models.insertModel(modelProps); // will be the same value as modeledElementId
1104
- }
1105
- }
1106
- exports.TemplateRecipe2d = TemplateRecipe2d;
1107
- /** An abstract base class for elements that establishes a particular modeling perspective for its parent Subject.
1108
- * Instances are always sub-modeled by a specialization of Model of the appropriate modeling perspective.
1109
- * @see [iModel Information Hierarchy]($docs/bis/guide/data-organization/top-of-the-world), [[Subject]], [[Model]]
1110
- * @public
1111
- */
1112
- class InformationPartitionElement extends InformationContentElement {
1113
- /** @internal */
1114
- constructor(props, iModel) { super(props, iModel); }
1115
- /** @internal */
1116
- static get className() { return "InformationPartitionElement"; }
1117
- /** @internal */
1118
- toJSON() {
1119
- return super.toJSON(); // Entity.toJSON takes care of auto-handled properties
1120
- }
1121
- /** Create a code that can be used for any subclass of InformationPartitionElement.
1122
- * @param iModelDb The IModelDb
1123
- * @param parentSubjectId The Id of the parent Subject that provides the scope for names of its child InformationPartitionElements.
1124
- * @param codeValue The InformationPartitionElement name
1125
- */
1126
- static createCode(iModel, parentSubjectId, codeValue) {
1127
- const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.informationPartitionElement);
1128
- return new core_common_1.Code({ spec: codeSpec.id, scope: parentSubjectId, value: codeValue });
1129
- }
1130
- }
1131
- exports.InformationPartitionElement = InformationPartitionElement;
1132
- /** A DefinitionPartition element establishes a *Definition* modeling perspective for its parent Subject.
1133
- * A DefinitionPartition is always sub-modeled by a DefinitionModel.
1134
- * @see [[DefinitionModel]]
1135
- * @public
1136
- */
1137
- class DefinitionPartition extends InformationPartitionElement {
1138
- /** @internal */
1139
- static get className() { return "DefinitionPartition"; }
1140
- }
1141
- exports.DefinitionPartition = DefinitionPartition;
1142
- /** A DocumentPartition element establishes a *Document* modeling perspective for its parent Subject.
1143
- * A DocumentPartition is always sub-modeled by a DocumentListModel.
1144
- * @see [[DocumentListModel]]
1145
- * @public
1146
- */
1147
- class DocumentPartition extends InformationPartitionElement {
1148
- /** @internal */
1149
- static get className() { return "DocumentPartition"; }
1150
- }
1151
- exports.DocumentPartition = DocumentPartition;
1152
- /** A GroupInformationPartition element establishes a *Group Information* modeling perspective for its parent Subject.
1153
- * A GroupInformationPartition is always sub-modeled by a GroupInformationModel.
1154
- * @see [[GroupInformationModel]]
1155
- * @public
1156
- */
1157
- class GroupInformationPartition extends InformationPartitionElement {
1158
- /** @internal */
1159
- static get className() { return "GroupInformationPartition"; }
1160
- }
1161
- exports.GroupInformationPartition = GroupInformationPartition;
1162
- /** A GraphicalPartition3d element establishes a *3D Graphical* modeling perspective for its parent Subject.
1163
- * A GraphicalPartition3d is always sub-modeled by a GraphicalModel3d.
1164
- * @note The associated ECClass was added to the BisCore schema in version 1.0.8
1165
- * @see [[GraphicalModel3d]]
1166
- * @public
1167
- */
1168
- class GraphicalPartition3d extends InformationPartitionElement {
1169
- /** @internal */
1170
- static get className() { return "GraphicalPartition3d"; }
1171
- }
1172
- exports.GraphicalPartition3d = GraphicalPartition3d;
1173
- /** An InformationRecordPartition element establishes a *Information Record* modeling perspective for its parent Subject.
1174
- * A InformationRecordPartition is always sub-modeled by an InformationRecordModel.
1175
- * @see [[InformationRecordModel]]
1176
- * @public
1177
- */
1178
- class InformationRecordPartition extends InformationPartitionElement {
1179
- /** @internal */
1180
- static get className() { return "InformationRecordPartition"; }
1181
- }
1182
- exports.InformationRecordPartition = InformationRecordPartition;
1183
- /** A LinkPartition element establishes a *Link* modeling perspective for its parent Subject. A LinkPartition is always sub-modeled by a LinkModel.
1184
- * @see [[LinkModel]]
1185
- * @public
1186
- */
1187
- class LinkPartition extends InformationPartitionElement {
1188
- /** @internal */
1189
- static get className() { return "LinkPartition"; }
1190
- }
1191
- exports.LinkPartition = LinkPartition;
1192
- /** A PhysicalPartition element establishes a *Physical* modeling perspective for its parent Subject. A PhysicalPartition is always sub-modeled by a PhysicalModel.
1193
- * @see [[PhysicalModel]]
1194
- * @public
1195
- */
1196
- class PhysicalPartition extends InformationPartitionElement {
1197
- /** @internal */
1198
- static get className() { return "PhysicalPartition"; }
1199
- }
1200
- exports.PhysicalPartition = PhysicalPartition;
1201
- /** A SpatialLocationPartition element establishes a *SpatialLocation* modeling perspective for its parent Subject.
1202
- * A SpatialLocationPartition is always sub-modeled by a SpatialLocationModel.
1203
- * @see [[SpatialLocationModel]]
1204
- * @public
1205
- */
1206
- class SpatialLocationPartition extends InformationPartitionElement {
1207
- /** @internal */
1208
- static get className() { return "SpatialLocationPartition"; }
1209
- }
1210
- exports.SpatialLocationPartition = SpatialLocationPartition;
1211
- /** Group Information is an abstract base class for modeling entities whose main purpose is to reference a group of related elements.
1212
- * @public
1213
- */
1214
- class GroupInformationElement extends InformationReferenceElement {
1215
- /** @internal */
1216
- static get className() { return "GroupInformationElement"; }
1217
- }
1218
- exports.GroupInformationElement = GroupInformationElement;
1219
- /** An information element that specifies a link.
1220
- * @public
1221
- */
1222
- class LinkElement extends InformationReferenceElement {
1223
- /** @internal */
1224
- static get className() { return "LinkElement"; }
1225
- /** Create a Code for a LinkElement given a name that is meant to be unique within the scope of the specified Model.
1226
- * @param iModel The IModelDb
1227
- * @param scopeModelId The Id of the Model that contains the LinkElement and provides the scope for its name.
1228
- * @param codeValue The LinkElement name
1229
- */
1230
- static createCode(iModel, scopeModelId, codeValue) {
1231
- const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.linkElement);
1232
- return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
1233
- }
1234
- }
1235
- exports.LinkElement = LinkElement;
1236
- /** An information element that specifies a URL link.
1237
- * @public
1238
- */
1239
- class UrlLink extends LinkElement {
1240
- /** @internal */
1241
- constructor(props, iModel) {
1242
- super(props, iModel);
1243
- this.description = props.description;
1244
- this.url = props.url;
1245
- }
1246
- /** @internal */
1247
- static get className() { return "UrlLink"; }
1248
- /** @internal */
1249
- toJSON() {
1250
- const val = super.toJSON();
1251
- val.description = this.description;
1252
- val.url = this.url;
1253
- return val;
1254
- }
1255
- }
1256
- exports.UrlLink = UrlLink;
1257
- /** Represents a folder-like structure that organizes repositories (typically files) in an external system.
1258
- * @note The associated ECClass was added to the BisCore schema in version 1.0.13
1259
- * @alpha
1260
- */
1261
- class FolderLink extends UrlLink {
1262
- /** @internal */
1263
- static get className() { return "FolderLink"; }
1264
- }
1265
- exports.FolderLink = FolderLink;
1266
- /** An information element that links to a repository.
1267
- * @public
1268
- */
1269
- class RepositoryLink extends UrlLink {
1270
- /** @internal */
1271
- constructor(props, iModel) {
1272
- super(props, iModel);
1273
- this.repositoryGuid = props.repositoryGuid;
1274
- this.format = props.format;
1275
- }
1276
- /** @internal */
1277
- static get className() { return "RepositoryLink"; }
1278
- /** @internal */
1279
- toJSON() {
1280
- const val = super.toJSON();
1281
- val.repositoryGuid = this.repositoryGuid;
1282
- val.format = this.format;
1283
- return val;
1284
- }
1285
- }
1286
- exports.RepositoryLink = RepositoryLink;
1287
- /** An information element that links to an embedded file.
1288
- * @public
1289
- */
1290
- class EmbeddedFileLink extends LinkElement {
1291
- /** @internal */
1292
- static get className() { return "EmbeddedFileLink"; }
1293
- }
1294
- exports.EmbeddedFileLink = EmbeddedFileLink;
1295
- /** A real world entity is modeled as a Role Element when a set of external circumstances define an important
1296
- * role (one that is worth tracking) that is not intrinsic to the entity playing the role. For example,
1297
- * a person can play the role of a teacher or a rock can play the role of a boundary marker.
1298
- * @public
1299
- */
1300
- class RoleElement extends Element {
1301
- /** @internal */
1302
- static get className() { return "RoleElement"; }
1303
- }
1304
- exports.RoleElement = RoleElement;
1305
- /** A Definition Element that specifies a collection of geometry that is meant to be reused across Geometric
1306
- * Element instances. Leveraging Geometry Parts can help reduce file size and improve display performance.
1307
- * @public
1308
- */
1309
- class GeometryPart extends DefinitionElement {
1310
- /** @internal */
1311
- constructor(props, iModel) {
1312
- super(props, iModel);
1313
- this.geom = props.geom;
1314
- this.bbox = core_geometry_1.Range3d.fromJSON(props.bbox);
1315
- }
1316
- /** @internal */
1317
- static get className() { return "GeometryPart"; }
1318
- /** @internal */
1319
- toJSON() {
1320
- const val = super.toJSON();
1321
- val.geom = this.geom;
1322
- val.bbox = this.bbox;
1323
- return val;
1324
- }
1325
- /** Create a Code for a GeometryPart element given a name that is meant to be unique within the scope of the specified DefinitionModel.
1326
- * @param iModel The IModelDb
1327
- * @param scopeModelId The Id of the DefinitionModel that contains the GeometryPart element and provides the scope for its name.
1328
- * @param codeValue The GeometryPart name
1329
- * @note GeometryPart elements are not required to be named (have a non-empty Code).
1330
- */
1331
- static createCode(iModel, scopeModelId, codeValue) {
1332
- const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.geometryPart);
1333
- return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
1334
- }
1335
- }
1336
- exports.GeometryPart = GeometryPart;
1337
- /** The definition element for a line style
1338
- * @public
1339
- */
1340
- class LineStyle extends DefinitionElement {
1341
- /** @internal */
1342
- constructor(props, iModel) { super(props, iModel); }
1343
- /** @internal */
1344
- static get className() { return "LineStyle"; }
1345
- /** Create a Code for a LineStyle definition given a name that is meant to be unique within the scope of the specified model.
1346
- * @param iModel The IModel
1347
- * @param scopeModelId The Id of the DefinitionModel that contains the LineStyle and provides the scope for its name.
1348
- * @param codeValue The name of the LineStyle
1349
- * @returns A LineStyle Code
1350
- */
1351
- static createCode(iModel, scopeModelId, codeValue) {
1352
- return new core_common_1.Code({ spec: iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.lineStyle).id, scope: scopeModelId, value: codeValue });
1353
- }
1354
- }
1355
- exports.LineStyle = LineStyle;
1356
- /** Describes how to animate a view of a [[GeometricModel]] to show change over time using a [RenderSchedule.Script]($common).
1357
- * @note This class was introduced in version 01.00.13 of the BisCore ECSchema. It should only be used with [[IModelDb]]s containing that version or newer.
1358
- * @public
1359
- */
1360
- class RenderTimeline extends InformationRecordElement {
1361
- /** @internal */
1362
- constructor(props, iModel) {
1363
- var _c;
1364
- super(props, iModel);
1365
- this.description = (_c = props.description) !== null && _c !== void 0 ? _c : "";
1366
- this.scriptProps = RenderTimeline.parseScriptProps(props.script);
1367
- }
1368
- /** @internal */
1369
- static get className() { return "RenderTimeline"; }
1370
- static fromJSON(props, iModel) {
1371
- return new RenderTimeline(props, iModel);
1372
- }
1373
- toJSON() {
1374
- const props = super.toJSON();
1375
- if (this.description.length > 0)
1376
- props.description = this.description;
1377
- props.script = JSON.stringify(this.scriptProps);
1378
- return props;
1379
- }
1380
- static parseScriptProps(json) {
1381
- try {
1382
- return JSON.parse(json);
1383
- }
1384
- catch {
1385
- return [];
1386
- }
1387
- }
1388
- /** @internal */
1389
- collectReferenceConcreteIds(ids) {
1390
- super.collectReferenceConcreteIds(ids);
1391
- const script = core_common_1.RenderSchedule.Script.fromJSON(this.scriptProps);
1392
- script === null || script === void 0 ? void 0 : script.discloseIds(ids); // eslint-disable-line deprecation/deprecation
1393
- }
1394
- /** @alpha */
1395
- static onCloned(context, sourceProps, targetProps) {
1396
- super.onCloned(context, sourceProps, targetProps);
1397
- if (context.isBetweenIModels)
1398
- targetProps.script = JSON.stringify(this.remapScript(context, this.parseScriptProps(targetProps.script)));
1399
- }
1400
- /** Remap Ids when cloning a RenderSchedule.Script between iModels on a DisplayStyle or RenderTimeline.
1401
- * @internal
1402
- */
1403
- static remapScript(context, input) {
1404
- const scriptProps = [];
1405
- if (!Array.isArray(input))
1406
- return scriptProps;
1407
- const elementIds = new core_bentley_1.OrderedId64Array();
1408
- for (const model of input) {
1409
- const modelId = context.findTargetElementId(model.modelId);
1410
- if (!core_bentley_1.Id64.isValid(modelId))
1411
- continue;
1412
- model.modelId = modelId;
1413
- scriptProps.push(model);
1414
- for (const element of model.elementTimelines) {
1415
- elementIds.clear();
1416
- for (const sourceId of core_common_1.RenderSchedule.ElementTimeline.getElementIds(element.elementIds)) {
1417
- const targetId = context.findTargetElementId(sourceId);
1418
- if (core_bentley_1.Id64.isValid(targetId))
1419
- elementIds.insert(targetId);
1420
- }
1421
- element.elementIds = core_bentley_1.CompressedId64Set.compressIds(elementIds);
1422
- }
1423
- }
1424
- return scriptProps;
1425
- }
1426
- }
1427
- exports.RenderTimeline = RenderTimeline;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Elements
8
+ */
9
+ var _a, _b;
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.FolderLink = exports.UrlLink = exports.LinkElement = exports.GroupInformationElement = exports.SpatialLocationPartition = exports.PhysicalPartition = exports.LinkPartition = exports.InformationRecordPartition = exports.GraphicalPartition3d = exports.GroupInformationPartition = exports.DocumentPartition = exports.DefinitionPartition = exports.InformationPartitionElement = exports.TemplateRecipe2d = exports.GraphicalType2d = exports.TemplateRecipe3d = exports.SpatialLocationType = exports.PhysicalType = exports.RecipeDefinitionElement = exports.TypeDefinitionElement = exports.DefinitionGroup = exports.DefinitionContainer = exports.DefinitionSet = exports.DefinitionElement = exports.InformationRecordElement = exports.Sheet = exports.SheetTemplate = exports.SheetBorderTemplate = exports.SectionDrawing = exports.Drawing = exports.Document = exports.Subject = exports.InformationReferenceElement = exports.DriverBundleElement = exports.InformationContentElement = exports.SectionDrawingLocation = exports.VolumeElement = exports.SpatialLocationElement = exports.PhysicalElement = exports.SpatialElement = exports.TextAnnotation3d = exports.TextAnnotation2d = exports.DrawingGraphic = exports.AnnotationElement2d = exports.GraphicalElement2d = exports.GeometricElement2d = exports.GraphicalElement3d = exports.GeometricElement3d = exports.GeometricElement = exports.Element = void 0;
12
+ exports.RenderTimeline = exports.LineStyle = exports.GeometryPart = exports.RoleElement = exports.EmbeddedFileLink = exports.RepositoryLink = void 0;
13
+ const core_bentley_1 = require("@itwin/core-bentley");
14
+ const core_common_1 = require("@itwin/core-common");
15
+ const core_geometry_1 = require("@itwin/core-geometry");
16
+ const Entity_1 = require("./Entity");
17
+ const Model_1 = require("./Model");
18
+ const NavigationRelationship_1 = require("./NavigationRelationship");
19
+ /** Elements are the smallest individually identifiable building blocks for modeling the real world in an iModel.
20
+ * Each element represents an entity in the real world. Sets of Elements (contained in [[Model]]s) are used to model
21
+ * other Elements that represent larger scale real world entities. Using this recursive modeling strategy,
22
+ * Elements can represent entities at any scale. Elements can represent physical things or abstract concepts
23
+ * or simply be information records.
24
+ *
25
+ * Every Element has a 64-bit id (inherited from Entity) that uniquely identifies it within an iModel. Every Element also
26
+ * has a "code" that identifies its meaning in the real world. Additionally, Elements may have a "federationGuid"
27
+ * to hold a GUID, if the element was assigned that GUID by some other federated database. The iModel database enforces
28
+ * uniqueness of id, code, and federationGuid.
29
+ *
30
+ * See:
31
+ * * [Element Fundamentals]($docs/bis/guide/fundamentals/element-fundamentals.md)
32
+ * * [Working with schemas and elements in TypeScript]($docs/learning/backend/SchemasAndElementsInTypeScript.md)
33
+ * * [Creating elements]($docs/learning/backend/CreateElements.md)
34
+ * @public
35
+ */
36
+ class Element extends Entity_1.Entity {
37
+ /** @internal */
38
+ static get className() { return "Element"; }
39
+ /** @internal */
40
+ static get protectedOperations() { return ["onInsert", "onUpdate", "onDelete"]; }
41
+ /** constructor for Element.
42
+ * @internal
43
+ */
44
+ constructor(props, iModel) {
45
+ super(props, iModel);
46
+ this.code = core_common_1.Code.fromJSON(props.code); // TODO: Validate props.code - don't silently fail if it is the wrong type
47
+ this.model = core_common_1.RelatedElement.idFromJson(props.model);
48
+ this.parent = core_common_1.RelatedElement.fromJSON(props.parent);
49
+ this.federationGuid = props.federationGuid;
50
+ this.userLabel = props.userLabel;
51
+ this.jsonProperties = { ...props.jsonProperties }; // make sure we have our own copy
52
+ }
53
+ /** Called before a new Element is inserted.
54
+ * @note throw an exception to disallow the insert
55
+ * @note If you override this method, you must call super.
56
+ * @note `this` is the class of the Element to be inserted
57
+ * @beta
58
+ */
59
+ static onInsert(arg) {
60
+ const { iModel, props } = arg;
61
+ const operation = "insert";
62
+ iModel.channels.verifyChannel(arg.props.model);
63
+ iModel.locks.checkSharedLock(props.model, "model", operation); // inserting requires shared lock on model
64
+ if (props.parent) // inserting requires shared lock on parent, if present
65
+ iModel.locks.checkSharedLock(props.parent.id, "parent", operation);
66
+ iModel.codeService?.verifyCode(arg);
67
+ }
68
+ /** Called after a new Element was inserted.
69
+ * @note If you override this method, you must call super.
70
+ * @note `this` is the class of the Element that was inserted
71
+ * @beta
72
+ */
73
+ static onInserted(arg) {
74
+ arg.iModel.locks.elementWasCreated(arg.id);
75
+ }
76
+ /** Called before an Element is updated.
77
+ * @note throw an exception to disallow the update
78
+ * @note If you override this method, you must call super.
79
+ * @note `this` is the class of the Element to be updated
80
+ * @beta
81
+ */
82
+ static onUpdate(arg) {
83
+ const { iModel, props } = arg;
84
+ iModel.channels.verifyChannel(props.model);
85
+ iModel.locks.checkExclusiveLock(props.id, "element", "update"); // eslint-disable-line @typescript-eslint/no-non-null-assertion
86
+ iModel.codeService?.verifyCode(arg);
87
+ }
88
+ /** Called after an Element was updated.
89
+ * @note If you override this method, you must call super.
90
+ * @note `this` is the class of the Element that was updated
91
+ * @beta
92
+ */
93
+ static onUpdated(_arg) { }
94
+ /** Called before an Element is deleted.
95
+ * @note throw an exception to disallow the delete
96
+ * @note If you override this method, you must call super.
97
+ * @note `this` is the class of the Element to be deleted
98
+ * @beta
99
+ */
100
+ static onDelete(arg) {
101
+ arg.iModel.channels.verifyChannel(arg.model);
102
+ arg.iModel.locks.checkExclusiveLock(arg.id, "element", "delete");
103
+ }
104
+ /** Called after an Element was deleted.
105
+ * @note If you override this method, you must call super.
106
+ * @note `this` is the class of the Element that was deleted
107
+ * @beta
108
+ */
109
+ static onDeleted(_arg) { }
110
+ /** Called when an element with an instance of this class as its parent is about to be deleted.
111
+ * @note throw an exception if the element should not be deleted
112
+ * @note implementers should not presume that the element was deleted if this method does not throw,
113
+ * since the delete may fail for other reasons. Instead, rely on [[onChildDeleted]] for that purpose.
114
+ * @note `this` is the class of the parent Element whose child will be deleted
115
+ * @beta
116
+ */
117
+ static onChildDelete(_arg) { }
118
+ /** Called after an element with an instance of this class as its parent was successfully deleted.
119
+ * @note `this` is the class of the parent Element whose child was deleted
120
+ * @beta
121
+ */
122
+ static onChildDeleted(_arg) { }
123
+ /** Called when a *new element* with an instance of this class as its parent is about to be inserted.
124
+ * @note throw an exception if the element should not be inserted
125
+ * @note `this` is the class of the prospective parent Element.
126
+ * @beta
127
+ */
128
+ static onChildInsert(_arg) { }
129
+ /** Called after a *new element* with an instance of this class as its parent was inserted.
130
+ * @note `this` is the class of the parent Element.
131
+ * @beta
132
+ */
133
+ static onChildInserted(_arg) { }
134
+ /** Called when an element with an instance of this class as its parent is about to be updated.
135
+ * @note throw an exception if the element should not be updated
136
+ * @note `this` is the class of the parent Element.
137
+ * @beta
138
+ */
139
+ static onChildUpdate(_arg) { }
140
+ /** Called after an element with an instance of this the class as its parent was updated.
141
+ * @note `this` is the class of the parent Element.
142
+ * @beta
143
+ */
144
+ static onChildUpdated(_arg) { }
145
+ /** Called when an *existing element* is about to be updated so that an instance of this class will become its new parent.
146
+ * @note throw an exception if the element should not be added
147
+ * @note `this` is the class of the prospective parent Element.
148
+ * @beta
149
+ */
150
+ static onChildAdd(_arg) { }
151
+ /** Called after an *existing element* has been updated so that an instance of this class is its new parent.
152
+ * @note `this` is the class of the new parent Element.
153
+ * @beta
154
+ */
155
+ static onChildAdded(_arg) { }
156
+ /** Called when an element with an instance of this class as its parent is about to be updated change to a different parent.
157
+ * @note throw an exception if the element should not be dropped
158
+ * @note `this` is the class of the parent Element.
159
+ * @beta
160
+ */
161
+ static onChildDrop(_arg) { }
162
+ /** Called after an element with an instance of this class as its previous parent was updated to have a new parent.
163
+ * @note `this` is the class of the previous parent Element.
164
+ * @beta
165
+ */
166
+ static onChildDropped(_arg) { }
167
+ /** Called when an instance of this class is being *sub-modeled* by a new Model.
168
+ * @note throw an exception if model should not be inserted
169
+ * @note `this` is the class of Element to be sub-modeled.
170
+ * @beta
171
+ */
172
+ static onSubModelInsert(_arg) { }
173
+ /** Called after an instance of this class was *sub-modeled* by a new Model.
174
+ * @note `this` is the class of Element that is now sub-modeled.
175
+ * @beta
176
+ */
177
+ static onSubModelInserted(_arg) { }
178
+ /** Called when a sub-model of an instance of this class is being deleted.
179
+ * @note throw an exception if model should not be deleted
180
+ * @note `this` is the class of Element that is sub-modeled.
181
+ * @beta
182
+ */
183
+ static onSubModelDelete(_arg) { }
184
+ /** Called after a sub-model of an instance of this class was deleted.
185
+ * @note `this` is the class of Element that was sub-modeled.
186
+ * @beta
187
+ */
188
+ static onSubModelDeleted(_arg) { }
189
+ /** Called during the iModel transformation process after an Element from the source iModel was *cloned* for the target iModel.
190
+ * The transformation process automatically handles remapping BisCore properties and those that are properly described in ECSchema.
191
+ * This callback is only meant to be overridden if there are other Ids in non-standard locations that need to be remapped or other data that needs to be fixed up after the clone.
192
+ * @param _context The context that persists any remapping between the source iModel and target iModel.
193
+ * @param _sourceProps The ElementProps for the source Element that was cloned.
194
+ * @param _targetProps The ElementProps that are a result of the clone. These can be further modified.
195
+ * @note If you override this method, you must call super.
196
+ * @beta
197
+ */
198
+ static onCloned(_context, _sourceProps, _targetProps) { }
199
+ /** Called when a *root* element in a subgraph is changed and before its outputs are processed.
200
+ * This special callback is made when:
201
+ * * the element is part of an [[ElementDrivesElement]] graph, and
202
+ * * the element has no inputs, and
203
+ * * none of the element's outputs have been processed.
204
+ * @see [[ElementDrivesElement]] for more on element dependency graphs.
205
+ * @beta
206
+ */
207
+ static onBeforeOutputsHandled(_id, _iModel) { }
208
+ /** Called on an element in a graph after all of its inputs have been processed and before its outputs are processed.
209
+ * This callback is made when:
210
+ * * the specified element is part of an [[ElementDrivesElement]] graph, and
211
+ * * there was a direct change to some element upstream in the dependency graph.
212
+ * * all upstream elements in the graph have been processed.
213
+ * * none of the downstream elements have been processed.
214
+ * This method is not called if none of the element's inputs were changed.
215
+ * @see [[ElementDrivesElement]] for more on element dependency graphs.
216
+ * @beta
217
+ */
218
+ static onAllInputsHandled(_id, _iModel) { }
219
+ /** Save this Element's properties to an object for serializing to JSON.
220
+ * @internal
221
+ */
222
+ toJSON() {
223
+ const val = super.toJSON();
224
+ if (core_common_1.Code.isValid(this.code))
225
+ val.code = this.code;
226
+ val.model = this.model;
227
+ if (undefined !== this.userLabel) // NOTE: blank string should be included in JSON
228
+ val.userLabel = this.userLabel;
229
+ if (this.federationGuid)
230
+ val.federationGuid = this.federationGuid;
231
+ if (this.parent)
232
+ val.parent = this.parent;
233
+ if (Object.keys(this.jsonProperties).length > 0)
234
+ val.jsonProperties = this.jsonProperties;
235
+ return val;
236
+ }
237
+ /** Collect the Ids of this element's *references* at this level of the class hierarchy.
238
+ * @deprecated in 3.x. use [[collectReferenceIds]] instead, the use of the term *predecessors* was confusing and became inaccurate when the transformer could handle cycles
239
+ * @beta
240
+ */
241
+ collectPredecessorIds(predecessorIds) {
242
+ return this.collectReferenceIds(predecessorIds);
243
+ }
244
+ collectReferenceIds(referenceIds) {
245
+ super.collectReferenceIds(referenceIds);
246
+ referenceIds.addModel(this.model); // The modeledElement is a reference
247
+ if (this.code.scope && core_bentley_1.Id64.isValidId64(this.code.scope))
248
+ referenceIds.addElement(this.code.scope); // The element that scopes the code is a reference
249
+ if (this.parent)
250
+ referenceIds.addElement(this.parent.id); // A parent element is a reference
251
+ }
252
+ /** Get the Ids of this element's *references*. A *reference* is any element whose id is stored in the EC data of this element
253
+ * This is important for cloning operations but can be useful in other situations as well.
254
+ * @beta
255
+ * @deprecated in 3.x. use [[getReferenceIds]] instead, the use of the term *predecessors* was confusing and became inaccurate when the transformer could handle cycles
256
+ */
257
+ getPredecessorIds() {
258
+ return this.getReferenceIds();
259
+ }
260
+ /** Get the class metadata for this element. */
261
+ getClassMetaData() { return this.iModel.classMetaDataRegistry.find(this.classFullName); }
262
+ getAllUserProperties() {
263
+ if (!this.jsonProperties.UserProps)
264
+ this.jsonProperties.UserProps = new Object();
265
+ return this.jsonProperties.UserProps;
266
+ }
267
+ /** Get a set of JSON user properties by namespace */
268
+ getUserProperties(namespace) { return this.getAllUserProperties()[namespace]; }
269
+ /** Change a set of user JSON properties of this Element by namespace. */
270
+ setUserProperties(nameSpace, value) { this.getAllUserProperties()[nameSpace] = value; }
271
+ /** Remove a set of JSON user properties, specified by namespace, from this Element */
272
+ removeUserProperties(nameSpace) { delete this.getAllUserProperties()[nameSpace]; }
273
+ /** Get a JSON property of this element, by namespace */
274
+ getJsonProperty(nameSpace) { return this.jsonProperties[nameSpace]; }
275
+ setJsonProperty(nameSpace, value) { this.jsonProperties[nameSpace] = value; }
276
+ /** Get a display label for this Element. By default returns userLabel if present, otherwise code value. */
277
+ getDisplayLabel() { return this.userLabel ?? this.code.value; }
278
+ /** Get a list of HTML strings that describe this Element for the tooltip. Strings will be listed on separate lines in the tooltip.
279
+ * Any instances of the pattern `%{tag}` will be replaced by the localized value of tag.
280
+ */
281
+ getToolTipMessage() {
282
+ const addKey = (key) => `<b>%{iModelJs:Element.${key}}:</b> `; // %{iModelJs:Element.xxx} is replaced with localized value of xxx in frontend.
283
+ const msg = [];
284
+ const display = this.getDisplayLabel();
285
+ msg.push(display ? display : `${addKey("Id") + this.id}, ${addKey("Type")}${this.className}`);
286
+ if (this instanceof GeometricElement)
287
+ msg.push(addKey("Category") + this.iModel.elements.getElement(this.category).getDisplayLabel());
288
+ msg.push(addKey("Model") + this.iModel.elements.getElement(this.model).getDisplayLabel());
289
+ return msg;
290
+ }
291
+ /**
292
+ * Insert this Element into the iModel.
293
+ * @see [[IModelDb.Elements.insertElement]]
294
+ * @note For convenience, the value of `this.id` is updated to reflect the resultant element's id.
295
+ * However when `this.federationGuid` is not present or undefined, a new Guid will be generated and stored on the resultant element. But
296
+ * the value of `this.federationGuid` is *not* updated. Generally, it is best to re-read the element after inserting (e.g. via [[IModelDb.Elements.getElement]])
297
+ * if you intend to continue working with it. That will ensure its values reflect the persistent state.
298
+ */
299
+ insert() {
300
+ return this.id = this.iModel.elements.insertElement(this.toJSON());
301
+ }
302
+ /** Update this Element in the iModel. */
303
+ update() { this.iModel.elements.updateElement(this.toJSON()); }
304
+ /** Delete this Element from the iModel. */
305
+ delete() { this.iModel.elements.deleteElement(this.id); }
306
+ }
307
+ /** A *required reference* is an element that had to be inserted before this element could have been inserted.
308
+ * This is the list of property keys on this element that store references to those elements
309
+ * @note This should be overridden (with `super` called) at each level of the class hierarchy that introduces required references.
310
+ * @note any property listed here must be added to the reference ids in [[collectReferenceIds]]
311
+ * @beta
312
+ */
313
+ Element.requiredReferenceKeys = ["parent", "model"];
314
+ /** A map of every [[requiredReferenceKeys]] on this class to their entity type.
315
+ * @note This should be overridden (with `super` called) at each level of the class hierarchy that introduces required references.
316
+ * @alpha
317
+ */
318
+ Element.requiredReferenceKeyTypeMap = {
319
+ parent: core_common_1.ConcreteEntityTypes.Element,
320
+ model: core_common_1.ConcreteEntityTypes.Model,
321
+ };
322
+ exports.Element = Element;
323
+ /** An abstract base class to model real world entities that intrinsically have geometry.
324
+ * @public
325
+ */
326
+ class GeometricElement extends (_b = Element) {
327
+ /** @internal */
328
+ static get className() { return "GeometricElement"; }
329
+ /** @internal */
330
+ constructor(props, iModel) {
331
+ super(props, iModel);
332
+ this.category = core_bentley_1.Id64.fromJSON(props.category);
333
+ this.geom = props.geom;
334
+ }
335
+ /** Type guard for instanceof [[GeometricElement3d]] */
336
+ is3d() { return this instanceof GeometricElement3d; }
337
+ /** Type guard for instanceof [[GeometricElement2d]] */
338
+ is2d() { return this instanceof GeometricElement2d; }
339
+ /** Get the [Transform]($geometry) from the Placement of this GeometricElement */
340
+ getPlacementTransform() { return this.placement.transform; }
341
+ calculateRange3d() { return this.placement.calculateRange(); }
342
+ /** Obtain the JSON representation of this element. */
343
+ toJSON() {
344
+ const val = super.toJSON();
345
+ val.category = this.category;
346
+ if (this.geom)
347
+ val.geom = this.geom;
348
+ return val;
349
+ }
350
+ collectReferenceIds(referenceIds) {
351
+ super.collectReferenceIds(referenceIds);
352
+ referenceIds.addElement(this.category);
353
+ // TODO: GeometryPartIds?
354
+ }
355
+ }
356
+ _a = GeometricElement;
357
+ /** @beta */
358
+ GeometricElement.requiredReferenceKeys = [...Reflect.get(_b, "requiredReferenceKeys", _a), "category"];
359
+ /** @alpha */
360
+ GeometricElement.requiredReferenceKeyTypeMap = {
361
+ ...Reflect.get(_b, "requiredReferenceKeyTypeMap", _a),
362
+ category: core_common_1.ConcreteEntityTypes.Element,
363
+ };
364
+ exports.GeometricElement = GeometricElement;
365
+ /** An abstract base class to model real world entities that intrinsically have 3d geometry.
366
+ * See [how to create a GeometricElement3d]($docs/learning/backend/CreateElements.md#GeometricElement3d).
367
+ * @public
368
+ */
369
+ class GeometricElement3d extends GeometricElement {
370
+ /** @internal */
371
+ static get className() { return "GeometricElement3d"; }
372
+ /** @internal */
373
+ constructor(props, iModel) {
374
+ super(props, iModel);
375
+ this.placement = core_common_1.Placement3d.fromJSON(props.placement);
376
+ if (props.typeDefinition)
377
+ this.typeDefinition = core_common_1.TypeDefinition.fromJSON(props.typeDefinition);
378
+ }
379
+ /** @internal */
380
+ toJSON() {
381
+ const val = super.toJSON();
382
+ val.placement = this.placement;
383
+ if (undefined !== this.typeDefinition)
384
+ val.typeDefinition = this.typeDefinition;
385
+ return val;
386
+ }
387
+ collectReferenceIds(referenceIds) {
388
+ super.collectReferenceIds(referenceIds);
389
+ if (undefined !== this.typeDefinition)
390
+ referenceIds.addElement(this.typeDefinition.id);
391
+ }
392
+ }
393
+ exports.GeometricElement3d = GeometricElement3d;
394
+ /** A 3d Graphical Element
395
+ * @public
396
+ */
397
+ class GraphicalElement3d extends GeometricElement3d {
398
+ /** @internal */
399
+ static get className() { return "GraphicalElement3d"; }
400
+ /** @internal */
401
+ constructor(props, iModel) { super(props, iModel); }
402
+ }
403
+ exports.GraphicalElement3d = GraphicalElement3d;
404
+ /** An abstract base class to model information entities that intrinsically have 2d geometry.
405
+ * @public
406
+ */
407
+ class GeometricElement2d extends GeometricElement {
408
+ /** @internal */
409
+ static get className() { return "GeometricElement2d"; }
410
+ /** @internal */
411
+ constructor(props, iModel) {
412
+ super(props, iModel);
413
+ this.placement = core_common_1.Placement2d.fromJSON(props.placement);
414
+ if (props.typeDefinition)
415
+ this.typeDefinition = core_common_1.TypeDefinition.fromJSON(props.typeDefinition);
416
+ }
417
+ /** @internal */
418
+ toJSON() {
419
+ const val = super.toJSON();
420
+ val.placement = this.placement;
421
+ if (undefined !== this.typeDefinition)
422
+ val.typeDefinition = this.typeDefinition;
423
+ return val;
424
+ }
425
+ collectReferenceIds(referenceIds) {
426
+ super.collectReferenceIds(referenceIds);
427
+ if (undefined !== this.typeDefinition)
428
+ referenceIds.addElement(this.typeDefinition.id);
429
+ }
430
+ }
431
+ exports.GeometricElement2d = GeometricElement2d;
432
+ /** An abstract base class for 2d Geometric Elements that are used to convey information within graphical presentations (like drawings).
433
+ * @public
434
+ */
435
+ class GraphicalElement2d extends GeometricElement2d {
436
+ /** @internal */
437
+ static get className() { return "GraphicalElement2d"; }
438
+ /** @internal */
439
+ constructor(props, iModel) { super(props, iModel); }
440
+ }
441
+ exports.GraphicalElement2d = GraphicalElement2d;
442
+ /** 2d element used to annotate drawings and sheets.
443
+ * @public
444
+ */
445
+ class AnnotationElement2d extends GraphicalElement2d {
446
+ /** @internal */
447
+ static get className() { return "AnnotationElement2d"; }
448
+ /** @internal */
449
+ constructor(props, iModel) { super(props, iModel); }
450
+ }
451
+ exports.AnnotationElement2d = AnnotationElement2d;
452
+ /** 2d element used to persist graphics for use in drawings.
453
+ * @public
454
+ */
455
+ class DrawingGraphic extends GraphicalElement2d {
456
+ /** @internal */
457
+ static get className() { return "DrawingGraphic"; }
458
+ /** @internal */
459
+ constructor(props, iModel) { super(props, iModel); }
460
+ }
461
+ exports.DrawingGraphic = DrawingGraphic;
462
+ /** 2D Text Annotation
463
+ * @public
464
+ */
465
+ class TextAnnotation2d extends AnnotationElement2d {
466
+ /** @internal */
467
+ static get className() { return "TextAnnotation2d"; }
468
+ /** @internal */
469
+ constructor(props, iModel) { super(props, iModel); }
470
+ }
471
+ exports.TextAnnotation2d = TextAnnotation2d;
472
+ /** 3D Text Annotation
473
+ * @public
474
+ */
475
+ class TextAnnotation3d extends GraphicalElement3d {
476
+ /** @internal */
477
+ static get className() { return "TextAnnotation3d"; }
478
+ /** @internal */
479
+ constructor(props, iModel) { super(props, iModel); }
480
+ }
481
+ exports.TextAnnotation3d = TextAnnotation3d;
482
+ /** An Element that occupies real world space. Its coordinates are in the project space of its iModel.
483
+ * @public
484
+ */
485
+ class SpatialElement extends GeometricElement3d {
486
+ /** @internal */
487
+ static get className() { return "SpatialElement"; }
488
+ /** @internal */
489
+ constructor(props, iModel) { super(props, iModel); }
490
+ }
491
+ exports.SpatialElement = SpatialElement;
492
+ /** An Element that is spatially located, has mass, and can be *touched*.
493
+ * @public
494
+ */
495
+ class PhysicalElement extends SpatialElement {
496
+ /** @internal */
497
+ static get className() { return "PhysicalElement"; }
498
+ /** @internal */
499
+ constructor(props, iModel) {
500
+ super(props, iModel);
501
+ this.physicalMaterial = core_common_1.RelatedElement.fromJSON(props.physicalMaterial);
502
+ }
503
+ /** @internal */
504
+ toJSON() {
505
+ const val = super.toJSON();
506
+ val.physicalMaterial = this.physicalMaterial?.toJSON();
507
+ return val;
508
+ }
509
+ }
510
+ exports.PhysicalElement = PhysicalElement;
511
+ /** Identifies a *tracked* real world location but has no mass and cannot be *touched*.
512
+ * @public
513
+ */
514
+ class SpatialLocationElement extends SpatialElement {
515
+ /** @internal */
516
+ static get className() { return "SpatialLocationElement"; }
517
+ /** @internal */
518
+ constructor(props, iModel) { super(props, iModel); }
519
+ }
520
+ exports.SpatialLocationElement = SpatialLocationElement;
521
+ /** A Volume Element is a Spatial Location Element that is restricted to defining a volume.
522
+ * @public
523
+ */
524
+ class VolumeElement extends SpatialLocationElement {
525
+ /** @internal */
526
+ static get className() { return "VolumeElement"; }
527
+ /** @internal */
528
+ constructor(props, iModel) { super(props, iModel); }
529
+ }
530
+ exports.VolumeElement = VolumeElement;
531
+ /** A SectionDrawingLocation element identifies the location of a [[SectionDrawing]] in the context of a [[SpatialModel]],
532
+ * enabling [HyperModeling]($hypermodeling).
533
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.11.
534
+ * @public
535
+ */
536
+ class SectionDrawingLocation extends SpatialLocationElement {
537
+ /** @internal */
538
+ static get className() { return "SectionDrawingLocation"; }
539
+ constructor(props, iModel) {
540
+ super(props, iModel);
541
+ this.sectionView = core_common_1.RelatedElement.fromJSON(props.sectionView) ?? core_common_1.RelatedElement.none;
542
+ }
543
+ /** @internal */
544
+ toJSON() {
545
+ return {
546
+ ...super.toJSON(),
547
+ sectionView: this.sectionView.toJSON(),
548
+ };
549
+ }
550
+ }
551
+ exports.SectionDrawingLocation = SectionDrawingLocation;
552
+ /** Information Content Element is an abstract base class for modeling pure information entities. Only the
553
+ * core framework should directly subclass from Information Content Element. Domain and application developers
554
+ * should start with the most appropriate subclass of Information Content Element.
555
+ * @public
556
+ */
557
+ class InformationContentElement extends Element {
558
+ /** @internal */
559
+ static get className() { return "InformationContentElement"; }
560
+ /** @internal */
561
+ constructor(props, iModel) { super(props, iModel); }
562
+ }
563
+ exports.InformationContentElement = InformationContentElement;
564
+ /** Element used in conjunction with bis:ElementDrivesElement relationships to bundle multiple inputs before
565
+ * driving the output element.
566
+ * @beta
567
+ */
568
+ class DriverBundleElement extends InformationContentElement {
569
+ /** @internal */
570
+ static get className() { return "DriverBundleElement"; }
571
+ /** @internal */
572
+ constructor(props, iModel) { super(props, iModel); }
573
+ }
574
+ exports.DriverBundleElement = DriverBundleElement;
575
+ /** Information Reference is an abstract base class for modeling entities whose main purpose is to reference something else.
576
+ * @public
577
+ */
578
+ class InformationReferenceElement extends InformationContentElement {
579
+ /** @internal */
580
+ static get className() { return "InformationReferenceElement"; }
581
+ /** @internal */
582
+ constructor(props, iModel) { super(props, iModel); }
583
+ }
584
+ exports.InformationReferenceElement = InformationReferenceElement;
585
+ /** A Subject is an information element that describes what this repository (or part thereof) is about.
586
+ * See [how to create a Subject element]$(docs/learning/backend/CreateElements.md#Subject).
587
+ * @public
588
+ */
589
+ class Subject extends InformationReferenceElement {
590
+ /** @internal */
591
+ static get className() { return "Subject"; }
592
+ /** @internal */
593
+ constructor(props, iModel) { super(props, iModel); }
594
+ /** @internal */
595
+ toJSON() {
596
+ return super.toJSON(); // Entity.toJSON takes care of auto-handled properties
597
+ }
598
+ /** Create a Code for a Subject given a name that is meant to be unique within the scope of its parent Subject.
599
+ * @param iModelDb The IModelDb
600
+ * @param parentSubjectId The Id of the parent Subject that provides the scope for names of its child Subjects.
601
+ * @param codeValue The child Subject name
602
+ */
603
+ static createCode(iModelDb, parentSubjectId, codeValue) {
604
+ const codeSpec = iModelDb.codeSpecs.getByName(core_common_1.BisCodeSpec.subject);
605
+ return new core_common_1.Code({ spec: codeSpec.id, scope: parentSubjectId, value: codeValue });
606
+ }
607
+ /** Create a Subject
608
+ * @param iModelDb The IModelDb
609
+ * @param parentSubjectId The new Subject will be a child of this Subject
610
+ * @param name The name (codeValue) of the Subject
611
+ * @param description The optional description of the Subject
612
+ * @returns The newly constructed Subject
613
+ * @throws [[IModelError]] if there is a problem creating the Subject
614
+ */
615
+ static create(iModelDb, parentSubjectId, name, description) {
616
+ const subjectProps = {
617
+ classFullName: this.classFullName,
618
+ model: core_common_1.IModel.repositoryModelId,
619
+ parent: new NavigationRelationship_1.SubjectOwnsSubjects(parentSubjectId),
620
+ code: this.createCode(iModelDb, parentSubjectId, name),
621
+ description,
622
+ };
623
+ return new Subject(subjectProps, iModelDb);
624
+ }
625
+ /** Insert a Subject
626
+ * @param iModelDb Insert into this IModelDb
627
+ * @param parentSubjectId The new Subject will be inserted as a child of this Subject
628
+ * @param name The name (codeValue) of the Subject
629
+ * @param description The optional description of the Subject
630
+ * @returns The Id of the newly inserted Subject
631
+ * @throws [[IModelError]] if there is a problem inserting the Subject
632
+ */
633
+ static insert(iModelDb, parentSubjectId, name, description) {
634
+ const subject = this.create(iModelDb, parentSubjectId, name, description);
635
+ return iModelDb.elements.insertElement(subject.toJSON());
636
+ }
637
+ }
638
+ exports.Subject = Subject;
639
+ /** An InformationContentElement that identifies the content of a document.
640
+ * The realized form of a document is called a DocumentCarrier (different class than Document).
641
+ * For example, a will is a legal document. The will published into a PDF file is an ElectronicDocumentCopy.
642
+ * The will printed onto paper is a PrintedDocumentCopy.
643
+ * In this example, the Document only identifies, names, and tracks the content of the will.
644
+ * @public
645
+ */
646
+ class Document extends InformationContentElement {
647
+ /** @internal */
648
+ static get className() { return "Document"; }
649
+ /** @internal */
650
+ constructor(props, iModel) { super(props, iModel); }
651
+ }
652
+ exports.Document = Document;
653
+ /** A document that represents a drawing, that is, a two-dimensional graphical representation of engineering data. A Drawing element is usually modelled by a [[DrawingModel]].
654
+ * @public
655
+ */
656
+ class Drawing extends Document {
657
+ /** @internal */
658
+ static get className() { return "Drawing"; }
659
+ /** @internal */
660
+ constructor(props, iModel) { super(props, iModel); }
661
+ /** Create a Code for a Drawing given a name that is meant to be unique within the scope of the specified DocumentListModel.
662
+ * @param iModel The IModelDb
663
+ * @param scopeModelId The Id of the DocumentListModel that contains the Drawing and provides the scope for its name.
664
+ * @param codeValue The Drawing name
665
+ */
666
+ static createCode(iModel, scopeModelId, codeValue) {
667
+ const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.drawing);
668
+ return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
669
+ }
670
+ /** Insert a Drawing element and a DrawingModel that breaks it down.
671
+ * @param iModelDb Insert into this iModel
672
+ * @param documentListModelId Insert the new Drawing into this DocumentListModel
673
+ * @param name The name of the Drawing.
674
+ * @returns The Id of the newly inserted Drawing element and the DrawingModel that breaks it down (same value).
675
+ * @throws [[IModelError]] if unable to insert the element.
676
+ */
677
+ static insert(iModelDb, documentListModelId, name) {
678
+ const drawingProps = {
679
+ classFullName: this.classFullName,
680
+ model: documentListModelId,
681
+ code: this.createCode(iModelDb, documentListModelId, name),
682
+ };
683
+ const drawingId = iModelDb.elements.insertElement(drawingProps);
684
+ const model = iModelDb.models.createModel({
685
+ classFullName: Model_1.DrawingModel.classFullName,
686
+ modeledElement: { id: drawingId },
687
+ });
688
+ return iModelDb.models.insertModel(model.toJSON());
689
+ }
690
+ }
691
+ exports.Drawing = Drawing;
692
+ /** A document that represents a section drawing, that is, a graphical documentation derived from a planar
693
+ * section of a spatial view. A SectionDrawing element is modelled by a [[SectionDrawingModel]] or a [[GraphicalModel3d]].
694
+ * A [[SectionDrawingLocation]] can associate the drawing with a spatial location, enabling [HyperModeling]($hypermodeling).
695
+ * @public
696
+ */
697
+ class SectionDrawing extends Drawing {
698
+ /** @internal */
699
+ static get className() { return "SectionDrawing"; }
700
+ /** @internal */
701
+ constructor(props, iModel) {
702
+ super(props, iModel);
703
+ this.sectionType = core_bentley_1.JsonUtils.asInt(props.sectionType, core_common_1.SectionType.Section);
704
+ this.spatialView = core_common_1.RelatedElement.fromJSON(props.spatialView) ?? core_common_1.RelatedElement.none;
705
+ this.displaySpatialView = core_bentley_1.JsonUtils.asBool(props.jsonProperties?.displaySpatialView);
706
+ const json = props.jsonProperties;
707
+ if (!json)
708
+ return;
709
+ if (json.drawingToSpatialTransform)
710
+ this.drawingToSpatialTransform = core_geometry_1.Transform.fromJSON(json.drawingToSpatialTransform);
711
+ if (json.sheetToSpatialTransform)
712
+ this.sheetToSpatialTransform = core_geometry_1.Transform.fromJSON(json.sheetToSpatialTransform);
713
+ if (json.drawingBoundaryClip)
714
+ this.drawingBoundaryClip = core_geometry_1.ClipVector.fromJSON(json.drawingBoundaryClip);
715
+ }
716
+ /** Convert to JSON representation. */
717
+ toJSON() {
718
+ const props = {
719
+ ...super.toJSON(),
720
+ sectionType: this.sectionType,
721
+ spatialView: this.spatialView.toJSON(),
722
+ };
723
+ if (!props.jsonProperties)
724
+ props.jsonProperties = {};
725
+ props.jsonProperties.displaySpatialView = this.displaySpatialView ? true : undefined;
726
+ props.jsonProperties.drawingToSpatialTransform = this.drawingToSpatialTransform?.toJSON();
727
+ props.jsonProperties.sheetToSpatialTransform = this.sheetToSpatialTransform?.toJSON();
728
+ props.jsonProperties.drawingBoundaryClip = this.drawingBoundaryClip?.toJSON();
729
+ return props;
730
+ }
731
+ }
732
+ exports.SectionDrawing = SectionDrawing;
733
+ /** The template for a SheetBorder
734
+ * @public
735
+ */
736
+ class SheetBorderTemplate extends Document {
737
+ /** @internal */
738
+ static get className() { return "SheetBorderTemplate"; }
739
+ /** @internal */
740
+ constructor(props, iModel) { super(props, iModel); }
741
+ }
742
+ exports.SheetBorderTemplate = SheetBorderTemplate;
743
+ /** The template for a [[Sheet]]
744
+ * @public
745
+ */
746
+ class SheetTemplate extends Document {
747
+ /** @internal */
748
+ static get className() { return "SheetTemplate"; }
749
+ /** @internal */
750
+ constructor(props, iModel) { super(props, iModel); }
751
+ collectReferenceIds(referenceIds) {
752
+ super.collectReferenceIds(referenceIds);
753
+ if (undefined !== this.border)
754
+ referenceIds.addElement(this.border);
755
+ }
756
+ }
757
+ exports.SheetTemplate = SheetTemplate;
758
+ /** A digital representation of a *sheet of paper*. Modeled by a [[SheetModel]].
759
+ * @public
760
+ */
761
+ class Sheet extends Document {
762
+ /** @internal */
763
+ static get className() { return "Sheet"; }
764
+ /** @internal */
765
+ constructor(props, iModel) {
766
+ super(props, iModel);
767
+ this.height = core_bentley_1.JsonUtils.asDouble(props.height);
768
+ this.width = core_bentley_1.JsonUtils.asDouble(props.width);
769
+ this.scale = props.scale;
770
+ this.sheetTemplate = props.sheetTemplate ? core_bentley_1.Id64.fromJSON(props.sheetTemplate) : undefined;
771
+ }
772
+ collectReferenceIds(referenceIds) {
773
+ super.collectReferenceIds(referenceIds);
774
+ if (undefined !== this.sheetTemplate)
775
+ referenceIds.addElement(this.sheetTemplate);
776
+ }
777
+ /** Create a Code for a Sheet given a name that is meant to be unique within the scope of the specified DocumentListModel.
778
+ * @param iModel The IModelDb
779
+ * @param scopeModelId The Id of the DocumentListModel that contains the Sheet and provides the scope for its name.
780
+ * @param codeValue The Sheet name
781
+ */
782
+ static createCode(iModel, scopeModelId, codeValue) {
783
+ const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.sheet);
784
+ return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
785
+ }
786
+ }
787
+ exports.Sheet = Sheet;
788
+ /** Information Record Element is an abstract base class for modeling information records. Information Record
789
+ * Element is the default choice if no other subclass of Information Content Element makes sense.
790
+ * @public
791
+ */
792
+ class InformationRecordElement extends InformationContentElement {
793
+ /** @internal */
794
+ static get className() { return "InformationRecordElement"; }
795
+ /** @internal */
796
+ constructor(props, iModel) { super(props, iModel); }
797
+ }
798
+ exports.InformationRecordElement = InformationRecordElement;
799
+ /** A Definition Element holds configuration-related information that is meant to be referenced / shared.
800
+ * @public
801
+ */
802
+ class DefinitionElement extends InformationContentElement {
803
+ /** @internal */
804
+ static get className() { return "DefinitionElement"; }
805
+ /** @internal */
806
+ constructor(props, iModel) {
807
+ super(props, iModel);
808
+ this.isPrivate = true === props.isPrivate;
809
+ }
810
+ /** @internal */
811
+ toJSON() {
812
+ const val = super.toJSON();
813
+ val.isPrivate = this.isPrivate;
814
+ return val;
815
+ }
816
+ }
817
+ exports.DefinitionElement = DefinitionElement;
818
+ /** This abstract class unifies DefinitionGroup and DefinitionContainer for relationship endpoint purposes.
819
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.10
820
+ * @public
821
+ */
822
+ class DefinitionSet extends DefinitionElement {
823
+ /** @internal */
824
+ static get className() { return "DefinitionSet"; }
825
+ }
826
+ exports.DefinitionSet = DefinitionSet;
827
+ /** A DefinitionContainer exclusively owns a set of DefinitionElements contained within its sub-model (of type DefinitionModel).
828
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.10
829
+ * @public
830
+ */
831
+ class DefinitionContainer extends DefinitionSet {
832
+ /** @internal */
833
+ static get className() { return "DefinitionContainer"; }
834
+ /** Create a DefinitionContainer
835
+ * @param iModelDb The IModelDb
836
+ * @param definitionModelId The Id of the [DefinitionModel]($backend) that will contain this DefinitionContainer element.
837
+ * @param code The Code for this DefinitionContainer.
838
+ * @param isPrivate The optional hint, that if `true` means it should not be displayed in the UI.
839
+ * @returns The newly constructed DefinitionContainer
840
+ * @note There is not a predefined CodeSpec for DefinitionContainer elements, so it is the responsibility of the domain or application to create one.
841
+ * @throws [[IModelError]] if there is a problem creating the DefinitionContainer
842
+ */
843
+ static create(iModelDb, definitionModelId, code, isPrivate) {
844
+ const elementProps = {
845
+ classFullName: this.classFullName,
846
+ model: definitionModelId,
847
+ code,
848
+ isPrivate,
849
+ };
850
+ return new DefinitionContainer(elementProps, iModelDb);
851
+ }
852
+ /** Insert a DefinitionContainer and its sub-model.
853
+ * @param iModelDb Insert into this IModelDb
854
+ * @param definitionModelId The Id of the [DefinitionModel]($backend) that will contain this DefinitionContainer element.
855
+ * @param code The Code for this DefinitionContainer.
856
+ * @param isPrivate The optional hint, that if `true` means it should not be displayed in the UI.
857
+ * @returns The Id of the newly inserted DefinitionContainer and its newly inserted sub-model (of type DefinitionModel).
858
+ * @note There is not a predefined CodeSpec for DefinitionContainer elements, so it is the responsibility of the domain or application to create one.
859
+ * @throws [[IModelError]] if there is a problem inserting the DefinitionContainer
860
+ */
861
+ static insert(iModelDb, definitionModelId, code, isPrivate) {
862
+ const containerElement = this.create(iModelDb, definitionModelId, code, isPrivate);
863
+ const containerElementId = iModelDb.elements.insertElement(containerElement.toJSON());
864
+ const containerSubModelProps = {
865
+ classFullName: Model_1.DefinitionModel.classFullName,
866
+ modeledElement: { id: containerElementId },
867
+ isPrivate,
868
+ };
869
+ iModelDb.models.insertModel(containerSubModelProps);
870
+ return containerElementId;
871
+ }
872
+ }
873
+ exports.DefinitionContainer = DefinitionContainer;
874
+ /** A non-exclusive set of DefinitionElements grouped using the DefinitionGroupGroupsDefinitions relationship.
875
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.10
876
+ * @public
877
+ */
878
+ class DefinitionGroup extends DefinitionSet {
879
+ /** @internal */
880
+ static get className() { return "DefinitionGroup"; }
881
+ /** Create a DefinitionGroup
882
+ * @param iModelDb The IModelDb
883
+ * @param definitionModelId The Id of the [DefinitionModel]($backend) that will contain this DefinitionGroup element.
884
+ * @param code The Code for this DefinitionGroup
885
+ * @param isPrivate The optional hint, that if `true` means it should not be displayed in the UI.
886
+ * @returns The newly constructed DefinitionGroup
887
+ * @note There is not a predefined CodeSpec for DefinitionGroup elements, so it is the responsibility of the domain or application to create one.
888
+ * @throws [[IModelError]] if there is a problem creating the DefinitionGroup
889
+ */
890
+ static create(iModelDb, definitionModelId, code, isPrivate) {
891
+ const elementProps = {
892
+ classFullName: this.classFullName,
893
+ model: definitionModelId,
894
+ code,
895
+ isPrivate,
896
+ };
897
+ return new DefinitionGroup(elementProps, iModelDb);
898
+ }
899
+ }
900
+ exports.DefinitionGroup = DefinitionGroup;
901
+ /** Defines a set of properties (the *type*) that may be associated with an element.
902
+ * @public
903
+ */
904
+ class TypeDefinitionElement extends DefinitionElement {
905
+ /** @internal */
906
+ static get className() { return "TypeDefinitionElement"; }
907
+ /** @internal */
908
+ constructor(props, iModel) { super(props, iModel); }
909
+ collectReferenceIds(referenceIds) {
910
+ super.collectReferenceIds(referenceIds);
911
+ if (undefined !== this.recipe)
912
+ referenceIds.addElement(this.recipe.id);
913
+ }
914
+ }
915
+ exports.TypeDefinitionElement = TypeDefinitionElement;
916
+ /** Defines a recipe for generating instances from a definition.
917
+ * @beta
918
+ */
919
+ class RecipeDefinitionElement extends DefinitionElement {
920
+ /** @internal */
921
+ static get className() { return "RecipeDefinitionElement"; }
922
+ /** @internal */
923
+ constructor(props, iModel) { super(props, iModel); }
924
+ }
925
+ exports.RecipeDefinitionElement = RecipeDefinitionElement;
926
+ /** Defines a set of properties (the *type*) that can be associated with a Physical Element. A Physical
927
+ * Type has a strong correlation with something that can be ordered from a catalog since all instances
928
+ * share a common set of properties.
929
+ * @public
930
+ */
931
+ class PhysicalType extends TypeDefinitionElement {
932
+ /** @internal */
933
+ static get className() { return "PhysicalType"; }
934
+ /** @internal */
935
+ constructor(props, iModel) {
936
+ super(props, iModel);
937
+ this.physicalMaterial = core_common_1.RelatedElement.fromJSON(props.physicalMaterial);
938
+ }
939
+ /** @internal */
940
+ toJSON() {
941
+ const val = super.toJSON();
942
+ val.physicalMaterial = this.physicalMaterial?.toJSON();
943
+ return val;
944
+ }
945
+ /** Create a Code for a PhysicalType element given a name that is meant to be unique within the scope of the specified DefinitionModel.
946
+ * @param iModel The IModelDb
947
+ * @param scopeModelId The Id of the DefinitionModel that contains the PhysicalType element and provides the scope for its name.
948
+ * @param codeValue The PhysicalType name
949
+ */
950
+ static createCode(iModel, scopeModelId, codeValue) {
951
+ const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.physicalType);
952
+ return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
953
+ }
954
+ }
955
+ exports.PhysicalType = PhysicalType;
956
+ /** Defines a set of properties (the *type*) that can be associated with a spatial location.
957
+ * @public
958
+ */
959
+ class SpatialLocationType extends TypeDefinitionElement {
960
+ /** @internal */
961
+ static get className() { return "SpatialLocationType"; }
962
+ /** @internal */
963
+ constructor(props, iModel) { super(props, iModel); }
964
+ /** Create a Code for a SpatialLocationType element given a name that is meant to be unique within the scope of the specified DefinitionModel.
965
+ * @param iModel The IModelDb
966
+ * @param scopeModelId The Id of the DefinitionModel that contains the SpatialLocationType element and provides the scope for its name.
967
+ * @param codeValue The SpatialLocationType name
968
+ */
969
+ static createCode(iModel, scopeModelId, codeValue) {
970
+ const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.spatialLocationType);
971
+ return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
972
+ }
973
+ }
974
+ exports.SpatialLocationType = SpatialLocationType;
975
+ /** A TemplateRecipe3d is a DefinitionElement that has a sub-model that contains the 3d template elements.
976
+ * @beta
977
+ */
978
+ class TemplateRecipe3d extends RecipeDefinitionElement {
979
+ /** @internal */
980
+ static get className() { return "TemplateRecipe3d"; }
981
+ /** @internal */
982
+ constructor(props, iModel) { super(props, iModel); }
983
+ /** Create a Code for a TemplateRecipe3d given a name that is meant to be unique within the scope of its Model.
984
+ * @param iModelDb The IModelDb
985
+ * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe3d element.
986
+ * @param codeValue The name of the TemplateRecipe3d element.
987
+ */
988
+ static createCode(iModelDb, definitionModelId, codeValue) {
989
+ const codeSpec = iModelDb.codeSpecs.getByName(core_common_1.BisCodeSpec.templateRecipe3d);
990
+ return new core_common_1.Code({ spec: codeSpec.id, scope: definitionModelId, value: codeValue });
991
+ }
992
+ /** Create a TemplateRecipe3d
993
+ * @param iModelDb The IModelDb
994
+ * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe3d element.
995
+ * @param name The name (Code.value) of the TemplateRecipe3d
996
+ * @returns The newly constructed TemplateRecipe3d
997
+ * @throws [[IModelError]] if there is a problem creating the TemplateRecipe3d
998
+ */
999
+ static create(iModelDb, definitionModelId, name, isPrivate) {
1000
+ const elementProps = {
1001
+ classFullName: this.classFullName,
1002
+ model: definitionModelId,
1003
+ code: this.createCode(iModelDb, definitionModelId, name),
1004
+ isPrivate,
1005
+ };
1006
+ return new TemplateRecipe3d(elementProps, iModelDb);
1007
+ }
1008
+ /** Insert a TemplateRecipe3d and a PhysicalModel (sub-model) that will contain the 3d template elements.
1009
+ * @param iModelDb The IModelDb
1010
+ * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe3d element.
1011
+ * @param name The name (Code.value) of the TemplateRecipe3d
1012
+ * @returns The Id of the newly inserted TemplateRecipe3d and the PhysicalModel that sub-models it.
1013
+ * @throws [[IModelError]] if there is a problem inserting the TemplateRecipe3d or its sub-model.
1014
+ */
1015
+ static insert(iModelDb, definitionModelId, name, isPrivate) {
1016
+ const element = this.create(iModelDb, definitionModelId, name, isPrivate);
1017
+ const modeledElementId = iModelDb.elements.insertElement(element.toJSON());
1018
+ const modelProps = {
1019
+ classFullName: Model_1.PhysicalModel.classFullName,
1020
+ modeledElement: { id: modeledElementId },
1021
+ isTemplate: true,
1022
+ };
1023
+ return iModelDb.models.insertModel(modelProps); // will be the same value as modeledElementId
1024
+ }
1025
+ }
1026
+ exports.TemplateRecipe3d = TemplateRecipe3d;
1027
+ /** Defines a set of properties (the *type*) that can be associated with a 2D Graphical Element.
1028
+ * @public
1029
+ */
1030
+ class GraphicalType2d extends TypeDefinitionElement {
1031
+ /** @internal */
1032
+ static get className() { return "GraphicalType2d"; }
1033
+ /** @internal */
1034
+ constructor(props, iModel) { super(props, iModel); }
1035
+ /** Create a Code for a GraphicalType2d element given a name that is meant to be unique within the scope of the specified DefinitionModel.
1036
+ * @param iModel The IModelDb
1037
+ * @param scopeModelId The Id of the DefinitionModel that contains the GraphicalType2d element and provides the scope for its name.
1038
+ * @param codeValue The GraphicalType2d name
1039
+ */
1040
+ static createCode(iModel, scopeModelId, codeValue) {
1041
+ const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.graphicalType2d);
1042
+ return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
1043
+ }
1044
+ }
1045
+ exports.GraphicalType2d = GraphicalType2d;
1046
+ /** A recipe that uses a 2D template for creating new instances.
1047
+ * @beta
1048
+ */
1049
+ class TemplateRecipe2d extends RecipeDefinitionElement {
1050
+ /** @internal */
1051
+ static get className() { return "TemplateRecipe2d"; }
1052
+ /** @internal */
1053
+ constructor(props, iModel) { super(props, iModel); }
1054
+ /** Create a Code for a TemplateRecipe2d given a name that is meant to be unique within the scope of its Model.
1055
+ * @param iModelDb The IModelDb
1056
+ * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe2d element.
1057
+ * @param codeValue The name of the TemplateRecipe2d element.
1058
+ */
1059
+ static createCode(iModelDb, definitionModelId, codeValue) {
1060
+ const codeSpec = iModelDb.codeSpecs.getByName(core_common_1.BisCodeSpec.templateRecipe2d);
1061
+ return new core_common_1.Code({ spec: codeSpec.id, scope: definitionModelId, value: codeValue });
1062
+ }
1063
+ /** Create a TemplateRecipe2d
1064
+ * @param iModelDb The IModelDb
1065
+ * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe2d element.
1066
+ * @param name The name (Code.value) of the TemplateRecipe2d
1067
+ * @returns The newly constructed TemplateRecipe2d
1068
+ * @throws [[IModelError]] if there is a problem creating the TemplateRecipe2d
1069
+ */
1070
+ static create(iModelDb, definitionModelId, name, isPrivate) {
1071
+ const elementProps = {
1072
+ classFullName: this.classFullName,
1073
+ model: definitionModelId,
1074
+ code: this.createCode(iModelDb, definitionModelId, name),
1075
+ isPrivate,
1076
+ };
1077
+ return new TemplateRecipe2d(elementProps, iModelDb);
1078
+ }
1079
+ /** Insert a TemplateRecipe2d and a DrawingModel (sub-model) that will contain the 2d template elements.
1080
+ * @param iModelDb The IModelDb
1081
+ * @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe2d element.
1082
+ * @param name The name (Code.value) of the TemplateRecipe2d
1083
+ * @returns The Id of the newly inserted TemplateRecipe2d and the PhysicalModel that sub-models it.
1084
+ * @throws [[IModelError]] if there is a problem inserting the TemplateRecipe2d or its sub-model.
1085
+ */
1086
+ static insert(iModelDb, definitionModelId, name, isPrivate) {
1087
+ const element = this.create(iModelDb, definitionModelId, name, isPrivate);
1088
+ const modeledElementId = iModelDb.elements.insertElement(element.toJSON());
1089
+ const modelProps = {
1090
+ classFullName: Model_1.DrawingModel.classFullName,
1091
+ modeledElement: { id: modeledElementId },
1092
+ isTemplate: true,
1093
+ };
1094
+ return iModelDb.models.insertModel(modelProps); // will be the same value as modeledElementId
1095
+ }
1096
+ }
1097
+ exports.TemplateRecipe2d = TemplateRecipe2d;
1098
+ /** An abstract base class for elements that establishes a particular modeling perspective for its parent Subject.
1099
+ * Instances are always sub-modeled by a specialization of Model of the appropriate modeling perspective.
1100
+ * @see [iModel Information Hierarchy]($docs/bis/guide/data-organization/top-of-the-world), [[Subject]], [[Model]]
1101
+ * @public
1102
+ */
1103
+ class InformationPartitionElement extends InformationContentElement {
1104
+ /** @internal */
1105
+ static get className() { return "InformationPartitionElement"; }
1106
+ /** @internal */
1107
+ constructor(props, iModel) { super(props, iModel); }
1108
+ /** @internal */
1109
+ toJSON() {
1110
+ return super.toJSON(); // Entity.toJSON takes care of auto-handled properties
1111
+ }
1112
+ /** Create a code that can be used for any subclass of InformationPartitionElement.
1113
+ * @param iModelDb The IModelDb
1114
+ * @param parentSubjectId The Id of the parent Subject that provides the scope for names of its child InformationPartitionElements.
1115
+ * @param codeValue The InformationPartitionElement name
1116
+ */
1117
+ static createCode(iModel, parentSubjectId, codeValue) {
1118
+ const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.informationPartitionElement);
1119
+ return new core_common_1.Code({ spec: codeSpec.id, scope: parentSubjectId, value: codeValue });
1120
+ }
1121
+ }
1122
+ exports.InformationPartitionElement = InformationPartitionElement;
1123
+ /** A DefinitionPartition element establishes a *Definition* modeling perspective for its parent Subject.
1124
+ * A DefinitionPartition is always sub-modeled by a DefinitionModel.
1125
+ * @see [[DefinitionModel]]
1126
+ * @public
1127
+ */
1128
+ class DefinitionPartition extends InformationPartitionElement {
1129
+ /** @internal */
1130
+ static get className() { return "DefinitionPartition"; }
1131
+ }
1132
+ exports.DefinitionPartition = DefinitionPartition;
1133
+ /** A DocumentPartition element establishes a *Document* modeling perspective for its parent Subject.
1134
+ * A DocumentPartition is always sub-modeled by a DocumentListModel.
1135
+ * @see [[DocumentListModel]]
1136
+ * @public
1137
+ */
1138
+ class DocumentPartition extends InformationPartitionElement {
1139
+ /** @internal */
1140
+ static get className() { return "DocumentPartition"; }
1141
+ }
1142
+ exports.DocumentPartition = DocumentPartition;
1143
+ /** A GroupInformationPartition element establishes a *Group Information* modeling perspective for its parent Subject.
1144
+ * A GroupInformationPartition is always sub-modeled by a GroupInformationModel.
1145
+ * @see [[GroupInformationModel]]
1146
+ * @public
1147
+ */
1148
+ class GroupInformationPartition extends InformationPartitionElement {
1149
+ /** @internal */
1150
+ static get className() { return "GroupInformationPartition"; }
1151
+ }
1152
+ exports.GroupInformationPartition = GroupInformationPartition;
1153
+ /** A GraphicalPartition3d element establishes a *3D Graphical* modeling perspective for its parent Subject.
1154
+ * A GraphicalPartition3d is always sub-modeled by a GraphicalModel3d.
1155
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.8
1156
+ * @see [[GraphicalModel3d]]
1157
+ * @public
1158
+ */
1159
+ class GraphicalPartition3d extends InformationPartitionElement {
1160
+ /** @internal */
1161
+ static get className() { return "GraphicalPartition3d"; }
1162
+ }
1163
+ exports.GraphicalPartition3d = GraphicalPartition3d;
1164
+ /** An InformationRecordPartition element establishes a *Information Record* modeling perspective for its parent Subject.
1165
+ * A InformationRecordPartition is always sub-modeled by an InformationRecordModel.
1166
+ * @see [[InformationRecordModel]]
1167
+ * @public
1168
+ */
1169
+ class InformationRecordPartition extends InformationPartitionElement {
1170
+ /** @internal */
1171
+ static get className() { return "InformationRecordPartition"; }
1172
+ }
1173
+ exports.InformationRecordPartition = InformationRecordPartition;
1174
+ /** A LinkPartition element establishes a *Link* modeling perspective for its parent Subject. A LinkPartition is always sub-modeled by a LinkModel.
1175
+ * @see [[LinkModel]]
1176
+ * @public
1177
+ */
1178
+ class LinkPartition extends InformationPartitionElement {
1179
+ /** @internal */
1180
+ static get className() { return "LinkPartition"; }
1181
+ }
1182
+ exports.LinkPartition = LinkPartition;
1183
+ /** A PhysicalPartition element establishes a *Physical* modeling perspective for its parent Subject. A PhysicalPartition is always sub-modeled by a PhysicalModel.
1184
+ * @see [[PhysicalModel]]
1185
+ * @public
1186
+ */
1187
+ class PhysicalPartition extends InformationPartitionElement {
1188
+ /** @internal */
1189
+ static get className() { return "PhysicalPartition"; }
1190
+ }
1191
+ exports.PhysicalPartition = PhysicalPartition;
1192
+ /** A SpatialLocationPartition element establishes a *SpatialLocation* modeling perspective for its parent Subject.
1193
+ * A SpatialLocationPartition is always sub-modeled by a SpatialLocationModel.
1194
+ * @see [[SpatialLocationModel]]
1195
+ * @public
1196
+ */
1197
+ class SpatialLocationPartition extends InformationPartitionElement {
1198
+ /** @internal */
1199
+ static get className() { return "SpatialLocationPartition"; }
1200
+ }
1201
+ exports.SpatialLocationPartition = SpatialLocationPartition;
1202
+ /** Group Information is an abstract base class for modeling entities whose main purpose is to reference a group of related elements.
1203
+ * @public
1204
+ */
1205
+ class GroupInformationElement extends InformationReferenceElement {
1206
+ /** @internal */
1207
+ static get className() { return "GroupInformationElement"; }
1208
+ }
1209
+ exports.GroupInformationElement = GroupInformationElement;
1210
+ /** An information element that specifies a link.
1211
+ * @public
1212
+ */
1213
+ class LinkElement extends InformationReferenceElement {
1214
+ /** @internal */
1215
+ static get className() { return "LinkElement"; }
1216
+ /** Create a Code for a LinkElement given a name that is meant to be unique within the scope of the specified Model.
1217
+ * @param iModel The IModelDb
1218
+ * @param scopeModelId The Id of the Model that contains the LinkElement and provides the scope for its name.
1219
+ * @param codeValue The LinkElement name
1220
+ */
1221
+ static createCode(iModel, scopeModelId, codeValue) {
1222
+ const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.linkElement);
1223
+ return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
1224
+ }
1225
+ }
1226
+ exports.LinkElement = LinkElement;
1227
+ /** An information element that specifies a URL link.
1228
+ * @public
1229
+ */
1230
+ class UrlLink extends LinkElement {
1231
+ /** @internal */
1232
+ static get className() { return "UrlLink"; }
1233
+ /** @internal */
1234
+ constructor(props, iModel) {
1235
+ super(props, iModel);
1236
+ this.description = props.description;
1237
+ this.url = props.url;
1238
+ }
1239
+ /** @internal */
1240
+ toJSON() {
1241
+ const val = super.toJSON();
1242
+ val.description = this.description;
1243
+ val.url = this.url;
1244
+ return val;
1245
+ }
1246
+ }
1247
+ exports.UrlLink = UrlLink;
1248
+ /** Represents a folder-like structure that organizes repositories (typically files) in an external system.
1249
+ * @note The associated ECClass was added to the BisCore schema in version 1.0.13
1250
+ * @alpha
1251
+ */
1252
+ class FolderLink extends UrlLink {
1253
+ /** @internal */
1254
+ static get className() { return "FolderLink"; }
1255
+ }
1256
+ exports.FolderLink = FolderLink;
1257
+ /** An information element that links to a repository.
1258
+ * @public
1259
+ */
1260
+ class RepositoryLink extends UrlLink {
1261
+ /** @internal */
1262
+ static get className() { return "RepositoryLink"; }
1263
+ /** @internal */
1264
+ constructor(props, iModel) {
1265
+ super(props, iModel);
1266
+ this.repositoryGuid = props.repositoryGuid;
1267
+ this.format = props.format;
1268
+ }
1269
+ /** @internal */
1270
+ toJSON() {
1271
+ const val = super.toJSON();
1272
+ val.repositoryGuid = this.repositoryGuid;
1273
+ val.format = this.format;
1274
+ return val;
1275
+ }
1276
+ }
1277
+ exports.RepositoryLink = RepositoryLink;
1278
+ /** An information element that links to an embedded file.
1279
+ * @public
1280
+ */
1281
+ class EmbeddedFileLink extends LinkElement {
1282
+ /** @internal */
1283
+ static get className() { return "EmbeddedFileLink"; }
1284
+ }
1285
+ exports.EmbeddedFileLink = EmbeddedFileLink;
1286
+ /** A real world entity is modeled as a Role Element when a set of external circumstances define an important
1287
+ * role (one that is worth tracking) that is not intrinsic to the entity playing the role. For example,
1288
+ * a person can play the role of a teacher or a rock can play the role of a boundary marker.
1289
+ * @public
1290
+ */
1291
+ class RoleElement extends Element {
1292
+ /** @internal */
1293
+ static get className() { return "RoleElement"; }
1294
+ }
1295
+ exports.RoleElement = RoleElement;
1296
+ /** A Definition Element that specifies a collection of geometry that is meant to be reused across Geometric
1297
+ * Element instances. Leveraging Geometry Parts can help reduce file size and improve display performance.
1298
+ * @public
1299
+ */
1300
+ class GeometryPart extends DefinitionElement {
1301
+ /** @internal */
1302
+ static get className() { return "GeometryPart"; }
1303
+ /** @internal */
1304
+ constructor(props, iModel) {
1305
+ super(props, iModel);
1306
+ this.geom = props.geom;
1307
+ this.bbox = core_geometry_1.Range3d.fromJSON(props.bbox);
1308
+ }
1309
+ /** @internal */
1310
+ toJSON() {
1311
+ const val = super.toJSON();
1312
+ val.geom = this.geom;
1313
+ val.bbox = this.bbox;
1314
+ return val;
1315
+ }
1316
+ /** Create a Code for a GeometryPart element given a name that is meant to be unique within the scope of the specified DefinitionModel.
1317
+ * @param iModel The IModelDb
1318
+ * @param scopeModelId The Id of the DefinitionModel that contains the GeometryPart element and provides the scope for its name.
1319
+ * @param codeValue The GeometryPart name
1320
+ * @note GeometryPart elements are not required to be named (have a non-empty Code).
1321
+ */
1322
+ static createCode(iModel, scopeModelId, codeValue) {
1323
+ const codeSpec = iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.geometryPart);
1324
+ return new core_common_1.Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
1325
+ }
1326
+ }
1327
+ exports.GeometryPart = GeometryPart;
1328
+ /** The definition element for a line style
1329
+ * @public
1330
+ */
1331
+ class LineStyle extends DefinitionElement {
1332
+ /** @internal */
1333
+ static get className() { return "LineStyle"; }
1334
+ /** @internal */
1335
+ constructor(props, iModel) { super(props, iModel); }
1336
+ /** Create a Code for a LineStyle definition given a name that is meant to be unique within the scope of the specified model.
1337
+ * @param iModel The IModel
1338
+ * @param scopeModelId The Id of the DefinitionModel that contains the LineStyle and provides the scope for its name.
1339
+ * @param codeValue The name of the LineStyle
1340
+ * @returns A LineStyle Code
1341
+ */
1342
+ static createCode(iModel, scopeModelId, codeValue) {
1343
+ return new core_common_1.Code({ spec: iModel.codeSpecs.getByName(core_common_1.BisCodeSpec.lineStyle).id, scope: scopeModelId, value: codeValue });
1344
+ }
1345
+ }
1346
+ exports.LineStyle = LineStyle;
1347
+ /** Describes how to animate a view of a [[GeometricModel]] to show change over time using a [RenderSchedule.Script]($common).
1348
+ * @note This class was introduced in version 01.00.13 of the BisCore ECSchema. It should only be used with [[IModelDb]]s containing that version or newer.
1349
+ * @public
1350
+ */
1351
+ class RenderTimeline extends InformationRecordElement {
1352
+ /** @internal */
1353
+ static get className() { return "RenderTimeline"; }
1354
+ /** @internal */
1355
+ constructor(props, iModel) {
1356
+ super(props, iModel);
1357
+ this.description = props.description ?? "";
1358
+ this.scriptProps = RenderTimeline.parseScriptProps(props.script);
1359
+ }
1360
+ static fromJSON(props, iModel) {
1361
+ return new RenderTimeline(props, iModel);
1362
+ }
1363
+ toJSON() {
1364
+ const props = super.toJSON();
1365
+ if (this.description.length > 0)
1366
+ props.description = this.description;
1367
+ props.script = JSON.stringify(this.scriptProps);
1368
+ return props;
1369
+ }
1370
+ static parseScriptProps(json) {
1371
+ try {
1372
+ return JSON.parse(json);
1373
+ }
1374
+ catch {
1375
+ return [];
1376
+ }
1377
+ }
1378
+ collectReferenceIds(ids) {
1379
+ super.collectReferenceIds(ids);
1380
+ const script = core_common_1.RenderSchedule.Script.fromJSON(this.scriptProps);
1381
+ script?.discloseIds(ids); // eslint-disable-line deprecation/deprecation
1382
+ }
1383
+ /** @alpha */
1384
+ static onCloned(context, sourceProps, targetProps) {
1385
+ super.onCloned(context, sourceProps, targetProps);
1386
+ if (context.isBetweenIModels)
1387
+ targetProps.script = JSON.stringify(this.remapScript(context, this.parseScriptProps(targetProps.script)));
1388
+ }
1389
+ /** Remap Ids when cloning a RenderSchedule.Script between iModels on a DisplayStyle or RenderTimeline.
1390
+ * @internal
1391
+ */
1392
+ static remapScript(context, input) {
1393
+ const scriptProps = [];
1394
+ if (!Array.isArray(input))
1395
+ return scriptProps;
1396
+ const elementIds = new core_bentley_1.OrderedId64Array();
1397
+ for (const model of input) {
1398
+ const modelId = context.findTargetElementId(model.modelId);
1399
+ if (!core_bentley_1.Id64.isValid(modelId))
1400
+ continue;
1401
+ model.modelId = modelId;
1402
+ scriptProps.push(model);
1403
+ for (const element of model.elementTimelines) {
1404
+ elementIds.clear();
1405
+ for (const sourceId of core_common_1.RenderSchedule.ElementTimeline.getElementIds(element.elementIds)) {
1406
+ const targetId = context.findTargetElementId(sourceId);
1407
+ if (core_bentley_1.Id64.isValid(targetId))
1408
+ elementIds.insert(targetId);
1409
+ }
1410
+ element.elementIds = core_bentley_1.CompressedId64Set.compressIds(elementIds);
1411
+ }
1412
+ }
1413
+ return scriptProps;
1414
+ }
1415
+ }
1416
+ exports.RenderTimeline = RenderTimeline;
1428
1417
  //# sourceMappingURL=Element.js.map