@itwin/core-backend 3.0.0-dev.100

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