@itwin/core-backend 3.7.0-dev.3 → 3.7.0-dev.6

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