@itwin/core-backend 3.4.0-dev.8 → 3.5.0-dev.4

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