@itwin/core-backend 3.0.0-dev.98 → 3.0.0

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 (163) hide show
  1. package/CHANGELOG.md +211 -67
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/AliCloudStorageService.d.ts +8 -2
  4. package/lib/cjs/AliCloudStorageService.d.ts.map +1 -1
  5. package/lib/cjs/AliCloudStorageService.js +4 -5
  6. package/lib/cjs/AliCloudStorageService.js.map +1 -1
  7. package/lib/cjs/BackendHubAccess.d.ts +9 -9
  8. package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
  9. package/lib/cjs/BackendHubAccess.js.map +1 -1
  10. package/lib/cjs/BriefcaseManager.js +4 -3
  11. package/lib/cjs/BriefcaseManager.js.map +1 -1
  12. package/lib/cjs/Category.d.ts +1 -1
  13. package/lib/cjs/Category.d.ts.map +1 -1
  14. package/lib/cjs/Category.js +6 -6
  15. package/lib/cjs/Category.js.map +1 -1
  16. package/lib/cjs/ChangeSummaryManager.d.ts.map +1 -1
  17. package/lib/cjs/ChangeSummaryManager.js +2 -0
  18. package/lib/cjs/ChangeSummaryManager.js.map +1 -1
  19. package/lib/cjs/ChangedElementsDb.d.ts +2 -0
  20. package/lib/cjs/ChangedElementsDb.d.ts.map +1 -1
  21. package/lib/cjs/ChangedElementsDb.js +1 -1
  22. package/lib/cjs/ChangedElementsDb.js.map +1 -1
  23. package/lib/cjs/CheckpointManager.d.ts.map +1 -1
  24. package/lib/cjs/CheckpointManager.js +10 -7
  25. package/lib/cjs/CheckpointManager.js.map +1 -1
  26. package/lib/cjs/ClassRegistry.d.ts.map +1 -1
  27. package/lib/cjs/ClassRegistry.js +10 -3
  28. package/lib/cjs/ClassRegistry.js.map +1 -1
  29. package/lib/cjs/CloudStorageBackend.d.ts +2 -3
  30. package/lib/cjs/CloudStorageBackend.d.ts.map +1 -1
  31. package/lib/cjs/CloudStorageBackend.js +5 -2
  32. package/lib/cjs/CloudStorageBackend.js.map +1 -1
  33. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  34. package/lib/cjs/ConcurrentQuery.js +7 -0
  35. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  36. package/lib/cjs/DevTools.d.ts +2 -2
  37. package/lib/cjs/DevTools.d.ts.map +1 -1
  38. package/lib/cjs/DevTools.js +2 -2
  39. package/lib/cjs/DevTools.js.map +1 -1
  40. package/lib/cjs/DisplayStyle.d.ts +2 -2
  41. package/lib/cjs/DisplayStyle.d.ts.map +1 -1
  42. package/lib/cjs/DisplayStyle.js +15 -47
  43. package/lib/cjs/DisplayStyle.js.map +1 -1
  44. package/lib/cjs/ECDb.d.ts +5 -9
  45. package/lib/cjs/ECDb.d.ts.map +1 -1
  46. package/lib/cjs/ECDb.js +11 -14
  47. package/lib/cjs/ECDb.js.map +1 -1
  48. package/lib/cjs/ECSchemaXmlContext.d.ts +1 -0
  49. package/lib/cjs/ECSchemaXmlContext.d.ts.map +1 -1
  50. package/lib/cjs/ECSchemaXmlContext.js +10 -4
  51. package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
  52. package/lib/cjs/ECSqlStatement.d.ts +8 -8
  53. package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
  54. package/lib/cjs/ECSqlStatement.js +24 -15
  55. package/lib/cjs/ECSqlStatement.js.map +1 -1
  56. package/lib/cjs/Element.d.ts +16 -16
  57. package/lib/cjs/Element.d.ts.map +1 -1
  58. package/lib/cjs/Element.js +9 -9
  59. package/lib/cjs/Element.js.map +1 -1
  60. package/lib/cjs/ElementAspect.d.ts +2 -2
  61. package/lib/cjs/ElementAspect.d.ts.map +1 -1
  62. package/lib/cjs/ElementAspect.js +2 -2
  63. package/lib/cjs/ElementAspect.js.map +1 -1
  64. package/lib/cjs/ElementGraphics.js +1 -1
  65. package/lib/cjs/ElementGraphics.js.map +1 -1
  66. package/lib/cjs/Entity.d.ts +11 -3
  67. package/lib/cjs/Entity.d.ts.map +1 -1
  68. package/lib/cjs/Entity.js +10 -2
  69. package/lib/cjs/Entity.js.map +1 -1
  70. package/lib/cjs/ExportGraphics.d.ts +1 -1
  71. package/lib/cjs/ExportGraphics.d.ts.map +1 -1
  72. package/lib/cjs/ExportGraphics.js +3 -0
  73. package/lib/cjs/ExportGraphics.js.map +1 -1
  74. package/lib/cjs/GeometrySummary.d.ts.map +1 -1
  75. package/lib/cjs/GeometrySummary.js +5 -2
  76. package/lib/cjs/GeometrySummary.js.map +1 -1
  77. package/lib/cjs/IModelDb.d.ts +44 -26
  78. package/lib/cjs/IModelDb.d.ts.map +1 -1
  79. package/lib/cjs/IModelDb.js +114 -42
  80. package/lib/cjs/IModelDb.js.map +1 -1
  81. package/lib/cjs/IModelHost.d.ts +40 -19
  82. package/lib/cjs/IModelHost.d.ts.map +1 -1
  83. package/lib/cjs/IModelHost.js +70 -20
  84. package/lib/cjs/IModelHost.js.map +1 -1
  85. package/lib/cjs/IModelJsFs.js +1 -1
  86. package/lib/cjs/IModelJsFs.js.map +1 -1
  87. package/lib/cjs/IpcHost.js +2 -1
  88. package/lib/cjs/IpcHost.js.map +1 -1
  89. package/lib/cjs/LocalhostIpcHost.d.ts.map +1 -1
  90. package/lib/cjs/LocalhostIpcHost.js +10 -3
  91. package/lib/cjs/LocalhostIpcHost.js.map +1 -1
  92. package/lib/cjs/Material.d.ts +1 -1
  93. package/lib/cjs/Material.d.ts.map +1 -1
  94. package/lib/cjs/Material.js +1 -1
  95. package/lib/cjs/Material.js.map +1 -1
  96. package/lib/cjs/Model.d.ts +4 -4
  97. package/lib/cjs/Model.d.ts.map +1 -1
  98. package/lib/cjs/Model.js +3 -3
  99. package/lib/cjs/Model.js.map +1 -1
  100. package/lib/cjs/NativeHost.d.ts +4 -22
  101. package/lib/cjs/NativeHost.d.ts.map +1 -1
  102. package/lib/cjs/NativeHost.js +4 -56
  103. package/lib/cjs/NativeHost.js.map +1 -1
  104. package/lib/cjs/Relationship.d.ts +10 -9
  105. package/lib/cjs/Relationship.d.ts.map +1 -1
  106. package/lib/cjs/Relationship.js +14 -8
  107. package/lib/cjs/Relationship.js.map +1 -1
  108. package/lib/cjs/RpcBackend.d.ts +4 -0
  109. package/lib/cjs/RpcBackend.d.ts.map +1 -1
  110. package/lib/cjs/RpcBackend.js +7 -0
  111. package/lib/cjs/RpcBackend.js.map +1 -1
  112. package/lib/cjs/SQLiteDb.js +1 -1
  113. package/lib/cjs/SQLiteDb.js.map +1 -1
  114. package/lib/cjs/ServerBasedLocks.d.ts +4 -10
  115. package/lib/cjs/ServerBasedLocks.d.ts.map +1 -1
  116. package/lib/cjs/ServerBasedLocks.js +12 -20
  117. package/lib/cjs/ServerBasedLocks.js.map +1 -1
  118. package/lib/cjs/SqliteStatement.d.ts.map +1 -1
  119. package/lib/cjs/SqliteStatement.js.map +1 -1
  120. package/lib/cjs/Texture.js +1 -1
  121. package/lib/cjs/Texture.js.map +1 -1
  122. package/lib/cjs/TxnManager.js +1 -1
  123. package/lib/cjs/TxnManager.js.map +1 -1
  124. package/lib/cjs/ViewDefinition.d.ts +11 -11
  125. package/lib/cjs/ViewDefinition.d.ts.map +1 -1
  126. package/lib/cjs/ViewDefinition.js +5 -5
  127. package/lib/cjs/ViewDefinition.js.map +1 -1
  128. package/lib/cjs/assets/Settings.schema.json +25 -0
  129. package/lib/cjs/core-backend.d.ts +8 -1
  130. package/lib/cjs/core-backend.d.ts.map +1 -1
  131. package/lib/cjs/core-backend.js +9 -1
  132. package/lib/cjs/core-backend.js.map +1 -1
  133. package/lib/cjs/domains/FunctionalElements.d.ts +1 -1
  134. package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
  135. package/lib/cjs/domains/FunctionalElements.js.map +1 -1
  136. package/lib/cjs/domains/GenericElements.d.ts +2 -2
  137. package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
  138. package/lib/cjs/domains/GenericElements.js.map +1 -1
  139. package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts.map +1 -1
  140. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +33 -24
  141. package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
  142. package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts.map +1 -1
  143. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +10 -7
  144. package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
  145. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
  146. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +11 -1
  147. package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
  148. package/lib/cjs/rpc-impl/WipRpcImpl.d.ts.map +1 -1
  149. package/lib/cjs/rpc-impl/WipRpcImpl.js +3 -0
  150. package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
  151. package/lib/cjs/workspace/Settings.d.ts +182 -0
  152. package/lib/cjs/workspace/Settings.d.ts.map +1 -0
  153. package/lib/cjs/workspace/Settings.js +144 -0
  154. package/lib/cjs/workspace/Settings.js.map +1 -0
  155. package/lib/cjs/workspace/SettingsSpecRegistry.d.ts +68 -0
  156. package/lib/cjs/workspace/SettingsSpecRegistry.d.ts.map +1 -0
  157. package/lib/cjs/workspace/SettingsSpecRegistry.js +122 -0
  158. package/lib/cjs/workspace/SettingsSpecRegistry.js.map +1 -0
  159. package/lib/cjs/workspace/Workspace.d.ts +306 -0
  160. package/lib/cjs/workspace/Workspace.d.ts.map +1 -0
  161. package/lib/cjs/workspace/Workspace.js +372 -0
  162. package/lib/cjs/workspace/Workspace.js.map +1 -0
  163. package/package.json +33 -19
@@ -1 +1 @@
1
- {"version":3,"file":"ElementAspect.js","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA2H;AAC3H,qCAAkC;AAGlC,sDAA2D;AAwB3D;;;;GAIG;AACH,MAAa,aAAc,SAAQ,eAAM;IAKvC,gBAAgB;I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AC,QAAQ,CAAC;QAC7B,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QACzC,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAhED,oDAgEC;AAED,cAAc;AACd,WAAiB,oBAAoB;IACnC;;OAEG;IACH,IAAY,IASX;IATD,WAAY,IAAI;QACd,oFAAoF;QACpF,2BAAmB,CAAA;QACnB,yFAAyF;QACzF,qCAA6B,CAAA;QAC7B;;WAEG;QACH,uBAAe,CAAA;IACjB,CAAC,EATW,IAAI,GAAJ,yBAAI,KAAJ,yBAAI,QASf;AACH,CAAC,EAdgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAcpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementAspects\r\n */\r\n\r\nimport { ChannelRootAspectProps, ElementAspectProps, ExternalSourceAspectProps, RelatedElement } from \"@itwin/core-common\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/** Argument for the `ElementAspect.onXxx` static methods\r\n * @beta\r\n */\r\nexport interface OnAspectArg {\r\n /** The iModel for the aspect affected by this event. */\r\n iModel: IModelDb;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\r\n * @beta\r\n */\r\nexport interface OnAspectPropsArg extends OnAspectArg {\r\n /** The new properties of the aspect affected by this event. */\r\n props: Readonly<ElementAspectProps>;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\r\n * @beta\r\n */\r\nexport interface OnAspectIdArg extends OnAspectArg {\r\n /** The Id of the aspect affected by this event */\r\n aspectId: Id64String;\r\n}\r\n\r\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\r\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\r\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\r\n * @public\r\n */\r\nexport class ElementAspect extends Entity implements ElementAspectProps {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementAspect\"; }\r\n public element: RelatedElement;\r\n\r\n /** @internal */\r\n constructor(props: ElementAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.element = RelatedElement.fromJSON(props.element)!;\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): ElementAspectProps {\r\n const val = super.toJSON() as ElementAspectProps;\r\n val.element = this.element;\r\n return val;\r\n }\r\n\r\n /** Called before a new ElementAspect is inserted.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInsert(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called after a new ElementAspect was inserted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInserted(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdate(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called after an ElementAspect was updated.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDelete(_arg: OnAspectIdArg): void { }\r\n\r\n /** Called after an ElementAspect was deleted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDeleted(_arg: OnAspectIdArg): void { }\r\n}\r\n\r\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementUniqueAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementUniqueAspect\"; }\r\n}\r\n\r\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementMultiAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementMultiAspect\"; }\r\n}\r\n\r\n/** A ChannelRootAspect identifies an Element as the root of a *channel* which is a subset of the overall iModel hierarchy that is independently maintained.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\r\n * @public\r\n */\r\nexport class ChannelRootAspect extends ElementUniqueAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ChannelRootAspect\"; }\r\n\r\n /** The owner of the channel */\r\n public owner: string;\r\n\r\n /** @internal */\r\n constructor(props: ChannelRootAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.owner = props.owner;\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): ChannelRootAspectProps {\r\n const val = super.toJSON() as ChannelRootAspectProps;\r\n val.owner = this.owner;\r\n return val;\r\n }\r\n\r\n /** Insert a ChannelRootAspect on the specified element. */\r\n public static insert(iModel: IModelDb, ownerId: Id64String, ownerDescription: string) {\r\n const props: ChannelRootAspectProps = {\r\n classFullName: ChannelRootAspect.classFullName,\r\n element: { id: ownerId },\r\n owner: ownerDescription,\r\n };\r\n iModel.elements.insertAspect(props);\r\n }\r\n}\r\n\r\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\r\n * @public\r\n */\r\nexport class ExternalSourceAspect extends ElementMultiAspect implements ExternalSourceAspectProps {\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceAspect\"; }\r\n\r\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source. */\r\n public scope: RelatedElement;\r\n /** The identifier of the object in the source repository. */\r\n public identifier: string;\r\n /** The kind of object within the source repository. */\r\n public kind: string;\r\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\r\n public checksum?: string;\r\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\r\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\r\n * If present, this value must be guaranteed to change when any of the source object's content changes.\r\n */\r\n public version?: string;\r\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process. */\r\n public jsonProperties?: string;\r\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\r\n public source?: RelatedElement;\r\n\r\n /** @internal */\r\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.scope = RelatedElement.fromJSON(props.scope)!;\r\n this.source = RelatedElement.fromJSON(props.source);\r\n this.identifier = props.identifier;\r\n this.kind = props.kind;\r\n this.checksum = props.checksum;\r\n this.version = props.version;\r\n this.jsonProperties = props.jsonProperties;\r\n }\r\n\r\n /** Look up the ElementId of the element that contains an aspect with the specified Scope, Kind, and Identifier\r\n */\r\n public static findBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): { elementId?: Id64String, aspectId?: Id64String } {\r\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\r\n let elementId: Id64String | undefined;\r\n let aspectId: Id64String | undefined;\r\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\r\n statement.bindId(\"scope\", scope);\r\n statement.bindString(\"kind\", kind);\r\n statement.bindString(\"identifier\", identifier);\r\n if (DbResult.BE_SQLITE_ROW === statement.step()) {\r\n elementId = statement.getValue(0).getId();\r\n aspectId = statement.getValue(1).getId();\r\n }\r\n });\r\n return { elementId, aspectId };\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): ExternalSourceAspectProps {\r\n const val = super.toJSON() as ExternalSourceAspectProps;\r\n val.scope = this.scope;\r\n val.source = this.source;\r\n val.identifier = this.identifier;\r\n val.kind = this.kind;\r\n val.checksum = this.checksum;\r\n val.version = this.version;\r\n val.jsonProperties = this.jsonProperties;\r\n return val;\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace ExternalSourceAspect { // eslint-disable-line no-redeclare\r\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\r\n * @public\r\n */\r\n export enum Kind {\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\r\n Element = \"Element\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\r\n Relationship = \"Relationship\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\r\n * @see [[ExternalSourceAspect.scope]]\r\n */\r\n Scope = \"Scope\",\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ElementAspect.js","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA2H;AAC3H,qCAAkC;AAGlC,sDAA2D;AAwB3D;;;;GAIG;AACH,MAAa,aAAc,SAAQ,eAAM;IAKvC,gBAAgB;IAChB,YAAY,KAAyB,EAAE,MAAgB;QACrD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,4BAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC,+DAA+D;IACzH,CAAC;IARD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,eAAe,CAAC,CAAC,CAAC;IAS1E,gBAAgB;IACA,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAwB,CAAC;QACjD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,OAAO,GAAG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yBAAI,KAAJ,yBAAI,QASf;AACH,CAAC,EAdgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAcpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ElementAspects\r\n */\r\n\r\nimport { ChannelRootAspectProps, ElementAspectProps, ExternalSourceAspectProps, RelatedElement } from \"@itwin/core-common\";\r\nimport { Entity } from \"./Entity\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { ECSqlStatement } from \"./ECSqlStatement\";\r\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\r\n\r\n/** Argument for the `ElementAspect.onXxx` static methods\r\n * @beta\r\n */\r\nexport interface OnAspectArg {\r\n /** The iModel for the aspect affected by this event. */\r\n iModel: IModelDb;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\r\n * @beta\r\n */\r\nexport interface OnAspectPropsArg extends OnAspectArg {\r\n /** The new properties of the aspect affected by this event. */\r\n props: Readonly<ElementAspectProps>;\r\n}\r\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\r\n * @beta\r\n */\r\nexport interface OnAspectIdArg extends OnAspectArg {\r\n /** The Id of the aspect affected by this event */\r\n aspectId: Id64String;\r\n}\r\n\r\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\r\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\r\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\r\n * @public\r\n */\r\nexport class ElementAspect extends Entity {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementAspect\"; }\r\n public element: RelatedElement;\r\n\r\n /** @internal */\r\n constructor(props: ElementAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): ElementAspectProps {\r\n const val = super.toJSON() as ElementAspectProps;\r\n val.element = this.element;\r\n return val;\r\n }\r\n\r\n /** Called before a new ElementAspect is inserted.\r\n * @note throw an exception to disallow the insert\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInsert(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called after a new ElementAspect was inserted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onInserted(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is updated.\r\n * @note throw an exception to disallow the update\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdate(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called after an ElementAspect was updated.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\r\n\r\n /** Called before an ElementAspect is deleted.\r\n * @note throw an exception to disallow the delete\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDelete(_arg: OnAspectIdArg): void { }\r\n\r\n /** Called after an ElementAspect was deleted.\r\n * @note If you override this method, you must call super.\r\n * @beta\r\n */\r\n protected static onDeleted(_arg: OnAspectIdArg): void { }\r\n}\r\n\r\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementUniqueAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementUniqueAspect\"; }\r\n}\r\n\r\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\r\n * @public\r\n */\r\nexport class ElementMultiAspect extends ElementAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ElementMultiAspect\"; }\r\n}\r\n\r\n/** A ChannelRootAspect identifies an Element as the root of a *channel* which is a subset of the overall iModel hierarchy that is independently maintained.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.10\r\n * @public\r\n */\r\nexport class ChannelRootAspect extends ElementUniqueAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ChannelRootAspect\"; }\r\n\r\n /** The owner of the channel */\r\n public owner: string;\r\n\r\n /** @internal */\r\n constructor(props: ChannelRootAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.owner = props.owner;\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): ChannelRootAspectProps {\r\n const val = super.toJSON() as ChannelRootAspectProps;\r\n val.owner = this.owner;\r\n return val;\r\n }\r\n\r\n /** Insert a ChannelRootAspect on the specified element. */\r\n public static insert(iModel: IModelDb, ownerId: Id64String, ownerDescription: string) {\r\n const props: ChannelRootAspectProps = {\r\n classFullName: ChannelRootAspect.classFullName,\r\n element: { id: ownerId },\r\n owner: ownerDescription,\r\n };\r\n iModel.elements.insertAspect(props);\r\n }\r\n}\r\n\r\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\r\n * @public\r\n */\r\nexport class ExternalSourceAspect extends ElementMultiAspect {\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceAspect\"; }\r\n\r\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source. */\r\n public scope: RelatedElement;\r\n /** The identifier of the object in the source repository. */\r\n public identifier: string;\r\n /** The kind of object within the source repository. */\r\n public kind: string;\r\n /** The cryptographic hash (any algorithm) of the source object's content. If defined, it must be guaranteed to change when the source object's content changes. */\r\n public checksum?: string;\r\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\r\n * It will be used by the synchronization process to detect that a source object is unchanged so that computing a cryptographic hash can be avoided.\r\n * If present, this value must be guaranteed to change when any of the source object's content changes.\r\n */\r\n public version?: string;\r\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process. */\r\n public jsonProperties?: string;\r\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\r\n public source?: RelatedElement;\r\n\r\n /** @internal */\r\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\r\n this.source = RelatedElement.fromJSON(props.source);\r\n this.identifier = props.identifier;\r\n this.kind = props.kind;\r\n this.checksum = props.checksum;\r\n this.version = props.version;\r\n this.jsonProperties = props.jsonProperties;\r\n }\r\n\r\n /** Look up the ElementId of the element that contains an aspect with the specified Scope, Kind, and Identifier\r\n */\r\n public static findBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): { elementId?: Id64String, aspectId?: Id64String } {\r\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\r\n let elementId: Id64String | undefined;\r\n let aspectId: Id64String | undefined;\r\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\r\n statement.bindId(\"scope\", scope);\r\n statement.bindString(\"kind\", kind);\r\n statement.bindString(\"identifier\", identifier);\r\n if (DbResult.BE_SQLITE_ROW === statement.step()) {\r\n elementId = statement.getValue(0).getId();\r\n aspectId = statement.getValue(1).getId();\r\n }\r\n });\r\n return { elementId, aspectId };\r\n }\r\n\r\n /** @internal */\r\n public override toJSON(): ExternalSourceAspectProps {\r\n const val = super.toJSON() as ExternalSourceAspectProps;\r\n val.scope = this.scope;\r\n val.source = this.source;\r\n val.identifier = this.identifier;\r\n val.kind = this.kind;\r\n val.checksum = this.checksum;\r\n val.version = this.version;\r\n val.jsonProperties = this.jsonProperties;\r\n return val;\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace ExternalSourceAspect { // eslint-disable-line no-redeclare\r\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\r\n * @public\r\n */\r\n export enum Kind {\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\r\n Element = \"Element\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\r\n Relationship = \"Relationship\",\r\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\r\n * @see [[ExternalSourceAspect.scope]]\r\n */\r\n Scope = \"Scope\",\r\n }\r\n}\r\n"]}
@@ -14,7 +14,7 @@ const core_common_1 = require("@itwin/core-common");
14
14
  * @internal
15
15
  */
16
16
  async function generateElementGraphics(request, iModel) {
17
- const result = await iModel.nativeDb.generateElementGraphics(request);
17
+ const result = await iModel.nativeDb.generateElementGraphics(request); // ###TODO update package versions in addon
18
18
  let error;
19
19
  switch (result.status) {
20
20
  case 2 /* NoGeometry */:
@@ -1 +1 @@
1
- {"version":3,"file":"ElementGraphics.js","sourceRoot":"","sources":["../../src/ElementGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2D;AAC3D,oDAA8E;AAI9E;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAAC,OAAoC,EAAE,MAAgB;IAClG,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAEtE,IAAI,KAAyB,CAAC;IAC9B,QAAQ,MAAM,CAAC,MAAM,EAAE;QACrB,wBAAsC;QACtC;YACE,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB;YACE,KAAK,GAAG,cAAc,CAAC;YACvB,MAAM;QACR;YACE,KAAK,GAAG,8BAA8B,CAAC;YACvC,MAAM;QACR;YACE,KAAK,GAAG,cAAc,OAAO,CAAC,SAAS,YAAY,CAAC;YACpD,MAAM;QACR;YACE,KAAK,GAAG,yBAAyB,OAAO,CAAC,EAAE,GAAG,CAAC;YAC/C,MAAM;KACT;IAED,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AA1BD,0DA0BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ElementGraphicsRequestProps, IModelError } from \"@itwin/core-common\";\r\nimport { ElementGraphicsStatus } from \"@bentley/imodeljs-native\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\n/** See [[IModelDb.generateElementGraphics]] and IModelTileRpcImpl.requestElementGraphics.\r\n * @internal\r\n */\r\nexport async function generateElementGraphics(request: ElementGraphicsRequestProps, iModel: IModelDb): Promise<Uint8Array | undefined> {\r\n const result = await iModel.nativeDb.generateElementGraphics(request);\r\n\r\n let error: string | undefined;\r\n switch (result.status) {\r\n case ElementGraphicsStatus.NoGeometry:\r\n case ElementGraphicsStatus.Canceled:\r\n return undefined;\r\n case ElementGraphicsStatus.Success:\r\n return result.content;\r\n case ElementGraphicsStatus.InvalidJson:\r\n error = \"Invalid JSON\";\r\n break;\r\n case ElementGraphicsStatus.UnknownMajorFormatVersion:\r\n error = \"Unknown major format version\";\r\n break;\r\n case ElementGraphicsStatus.ElementNotFound:\r\n error = `Element Id ${request.elementId} not found`;\r\n break;\r\n case ElementGraphicsStatus.DuplicateRequestId:\r\n error = `Duplicate request Id \"${request.id}\"`;\r\n break;\r\n }\r\n\r\n assert(undefined !== error);\r\n throw new IModelError(IModelStatus.BadRequest, error);\r\n}\r\n"]}
1
+ {"version":3,"file":"ElementGraphics.js","sourceRoot":"","sources":["../../src/ElementGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA2D;AAC3D,oDAA8E;AAI9E;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAAC,OAAoC,EAAE,MAAgB;IAClG,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,OAAc,CAAC,CAAC,CAAC,2CAA2C;IAEzH,IAAI,KAAyB,CAAC;IAC9B,QAAQ,MAAM,CAAC,MAAM,EAAE;QACrB,wBAAsC;QACtC;YACE,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB;YACE,KAAK,GAAG,cAAc,CAAC;YACvB,MAAM;QACR;YACE,KAAK,GAAG,8BAA8B,CAAC;YACvC,MAAM;QACR;YACE,KAAK,GAAG,cAAc,OAAO,CAAC,SAAS,YAAY,CAAC;YACpD,MAAM;QACR;YACE,KAAK,GAAG,yBAAyB,OAAO,CAAC,EAAE,GAAG,CAAC;YAC/C,MAAM;KACT;IAED,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AA1BD,0DA0BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { assert, IModelStatus } from \"@itwin/core-bentley\";\r\nimport { ElementGraphicsRequestProps, IModelError } from \"@itwin/core-common\";\r\nimport { ElementGraphicsStatus } from \"@bentley/imodeljs-native\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\n/** See [[IModelDb.generateElementGraphics]] and IModelTileRpcImpl.requestElementGraphics.\r\n * @internal\r\n */\r\nexport async function generateElementGraphics(request: ElementGraphicsRequestProps, iModel: IModelDb): Promise<Uint8Array | undefined> {\r\n const result = await iModel.nativeDb.generateElementGraphics(request as any); // ###TODO update package versions in addon\r\n\r\n let error: string | undefined;\r\n switch (result.status) {\r\n case ElementGraphicsStatus.NoGeometry:\r\n case ElementGraphicsStatus.Canceled:\r\n return undefined;\r\n case ElementGraphicsStatus.Success:\r\n return result.content;\r\n case ElementGraphicsStatus.InvalidJson:\r\n error = \"Invalid JSON\";\r\n break;\r\n case ElementGraphicsStatus.UnknownMajorFormatVersion:\r\n error = \"Unknown major format version\";\r\n break;\r\n case ElementGraphicsStatus.ElementNotFound:\r\n error = `Element Id ${request.elementId} not found`;\r\n break;\r\n case ElementGraphicsStatus.DuplicateRequestId:\r\n error = `Duplicate request Id \"${request.id}\"`;\r\n break;\r\n }\r\n\r\n assert(undefined !== error);\r\n throw new IModelError(IModelStatus.BadRequest, error);\r\n}\r\n"]}
@@ -5,10 +5,16 @@ import { Id64String } from "@itwin/core-bentley";
5
5
  import { EntityProps, PropertyCallback } from "@itwin/core-common";
6
6
  import { IModelDb } from "./IModelDb";
7
7
  import { Schema } from "./Schema";
8
- /** Base class for all Entities in an iModel. Every subclass of Entity handles one BIS class.
8
+ /** Represents an entity in an [[IModelDb]] such as an [[Element]], [[Model]], or [[Relationship]].
9
+ * Every subclass of Entity represents one BIS [ECClass]($ecschema-metadata).
10
+ * An Entity is typically instantiated from an [EntityProps]($common) and can be converted back to this representation via [[Entity.toJSON]].
9
11
  * @public
10
12
  */
11
- export declare class Entity implements EntityProps {
13
+ export declare class Entity {
14
+ /** An immutable property used to discriminate between [[Entity]] and [EntityProps]($common), used to inform the TypeScript compiler that these two types
15
+ * are never substitutable for one another. To obtain an EntityProps from an Entity, use [[Entity.toJSON]].
16
+ */
17
+ readonly isInstanceOfEntity: true;
12
18
  /** The Schema that defines this class. */
13
19
  static schema: typeof Schema;
14
20
  private get _ctor();
@@ -33,7 +39,9 @@ export declare class Entity implements EntityProps {
33
39
  id: Id64String;
34
40
  /** @internal */
35
41
  constructor(props: EntityProps, iModel: IModelDb);
36
- /** @internal */
42
+ /** Obtain the JSON representation of this Entity. Subclasses of [[Entity]] typically override this method to return their corresponding sub-type of [EntityProps]($common) -
43
+ * for example, [[GeometricElement.toJSON]] returns a [GeometricElementProps]($common).
44
+ */
37
45
  toJSON(): EntityProps;
38
46
  /** Call a function for each property of this Entity.
39
47
  * @param func The callback to be invoked on each property
@@ -1 +1 @@
1
- {"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../src/Entity.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAQ,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;GAEG;AACH,qBAAa,MAAO,YAAW,WAAW;IACxC,0CAA0C;IAC1C,OAAc,MAAM,EAAE,OAAO,MAAM,CAAC;IAEpC,OAAO,KAAK,KAAK,GAA+D;IAEhF;;;;OAIG;IACH,WAAkB,SAAS,IAAI,MAAM,CAAqB;IAE1D;;;OAGG;IACH,IAAW,KAAK,IAAI,GAAG,CAAiB;IAExC,yDAAyD;IACzD,IAAW,UAAU,IAAI,MAAM,CAAyC;IAExE,4DAA4D;IAC5D,IAAW,SAAS,IAAI,MAAM,CAAiC;IAE/D,iDAAiD;IAC1C,MAAM,EAAE,QAAQ,CAAC;IAExB,kGAAkG;IAC3F,EAAE,EAAE,UAAU,CAAC;IAEtB,gBAAgB;gBACJ,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ;IAOhD,gBAAgB;IACT,MAAM,IAAI,WAAW;IAS5B;;;;OAIG;IACI,eAAe,CAAC,IAAI,EAAE,gBAAgB,EAAE,aAAa,GAAE,OAAc;IAE5E,4EAA4E;IAC5E,WAAkB,aAAa,IAAI,MAAM,CAA0D;IAEnG,6EAA6E;IAC7E,IAAW,aAAa,IAAI,MAAM,CAAqC;IAEvE,gBA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C;IAEvE,gBAAgB;IAChB,WAAkB,mBAAmB,IAAI,MAAM,EAAE,CAAe;CACjE;AAED;;GAEG;AACH,oBAAY,eAAe,CAAC,CAAC,IAAI,QAAQ,GAAG;IAAE,SAAS,EAAE,CAAC,CAAA;CAAE,CAAC"}
package/lib/cjs/Entity.js CHANGED
@@ -10,12 +10,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Entity = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const IModelDb_1 = require("./IModelDb");
13
- /** Base class for all Entities in an iModel. Every subclass of Entity handles one BIS class.
13
+ /** Represents an entity in an [[IModelDb]] such as an [[Element]], [[Model]], or [[Relationship]].
14
+ * Every subclass of Entity represents one BIS [ECClass]($ecschema-metadata).
15
+ * An Entity is typically instantiated from an [EntityProps]($common) and can be converted back to this representation via [[Entity.toJSON]].
14
16
  * @public
15
17
  */
16
18
  class Entity {
17
19
  /** @internal */
18
20
  constructor(props, iModel) {
21
+ /** An immutable property used to discriminate between [[Entity]] and [EntityProps]($common), used to inform the TypeScript compiler that these two types
22
+ * are never substitutable for one another. To obtain an EntityProps from an Entity, use [[Entity.toJSON]].
23
+ */
24
+ this.isInstanceOfEntity = true;
19
25
  this.iModel = iModel;
20
26
  this.id = core_bentley_1.Id64.fromJSON(props.id);
21
27
  // copy all auto-handled properties from input to the object being constructed
@@ -37,7 +43,9 @@ class Entity {
37
43
  get schemaName() { return this._ctor.schema.schemaName; }
38
44
  /** The name of the BIS class associated with this class. */
39
45
  get className() { return this._ctor.className; }
40
- /** @internal */
46
+ /** Obtain the JSON representation of this Entity. Subclasses of [[Entity]] typically override this method to return their corresponding sub-type of [EntityProps]($common) -
47
+ * for example, [[GeometricElement.toJSON]] returns a [GeometricElementProps]($common).
48
+ */
41
49
  toJSON() {
42
50
  const val = {};
43
51
  val.classFullName = this.classFullName;
@@ -1 +1 @@
1
- {"version":3,"file":"Entity.js","sourceRoot":"","sources":["../../src/Entity.ts"],"names":[],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AI,IAAY,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC;QAC3F,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;OAIG;IACI,eAAe,CAAC,IAAsB,EAAE,gBAAyB,IAAI,IAAI,mBAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAEvK,4EAA4E;IACrE,MAAM,KAAK,aAAa,KAAa,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAEnG,6EAA6E;IAC7E,IAAW,aAAa,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAEvE,gBAAgB;IACT,MAAM,KAAK,mBAAmB,KAAe,OAAO,EAAE,CAAC,CAAC,CAAC;CACjE;AAhED,wBAgEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Schema\r\n */\r\n\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { EntityProps, PropertyCallback, PropertyMetaData } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { Schema } from \"./Schema\";\r\n\r\n/** Base class for all Entities in an iModel. Every subclass of Entity handles one BIS class.\r\n * @public\r\n */\r\nexport class Entity implements EntityProps {\r\n /** The Schema that defines this class. */\r\n public static schema: typeof Schema;\r\n\r\n private get _ctor(): typeof Entity { return this.constructor as typeof Entity; }\r\n\r\n /** The name of the BIS class associated with this class.\r\n * @note Every subclass of Entity **MUST** override this method to identify its BIS class.\r\n * Failure to do so will ordinarily result in an error when the class is registered, since there may only\r\n * be one JavaScript class for a given BIS class (usually the errant class will collide with its superclass.)\r\n */\r\n public static get className(): string { return \"Entity\"; }\r\n\r\n /** When working with an Entity it can be useful to set property values directly, bypassing the compiler's type checking.\r\n * This property makes such code slightly less tedious to read and write.\r\n * @internal\r\n */\r\n public get asAny(): any { return this; }\r\n\r\n /** The name of the BIS Schema that defines this class */\r\n public get schemaName(): string { return this._ctor.schema.schemaName; }\r\n\r\n /** The name of the BIS class associated with this class. */\r\n public get className(): string { return this._ctor.className; }\r\n\r\n /** The [[IModelDb]] that contains this Entity */\r\n public iModel: IModelDb;\r\n\r\n /** The Id of this Entity. May be invalid if the Entity has not yet been saved in the database. */\r\n public id: Id64String;\r\n\r\n /** @internal */\r\n constructor(props: EntityProps, iModel: IModelDb) {\r\n this.iModel = iModel;\r\n this.id = Id64.fromJSON(props.id);\r\n // copy all auto-handled properties from input to the object being constructed\r\n this.forEachProperty((propName: string, meta: PropertyMetaData) => (this as any)[propName] = meta.createProperty((props as any)[propName]), false);\r\n }\r\n\r\n /** @internal */\r\n public toJSON(): EntityProps {\r\n const val: any = {};\r\n val.classFullName = this.classFullName;\r\n if (Id64.isValid(this.id))\r\n val.id = this.id;\r\n this.forEachProperty((propName: string) => val[propName] = (this as any)[propName], false);\r\n return val;\r\n }\r\n\r\n /** Call a function for each property of this Entity.\r\n * @param func The callback to be invoked on each property\r\n * @param includeCustom If true (default), include custom-handled properties in the iteration. Otherwise, skip custom-handled properties.\r\n * @note Custom-handled properties are core properties that have behavior enforced by C++ handlers.\r\n */\r\n public forEachProperty(func: PropertyCallback, includeCustom: boolean = true) { IModelDb.forEachMetaData(this.iModel, this.classFullName, true, func, includeCustom); }\r\n\r\n /** Get the full BIS class name of this Entity in the form \"schema:class\" */\r\n public static get classFullName(): string { return `${this.schema.schemaName}:${this.className}`; }\r\n\r\n /** Get the full BIS class name of this Entity in the form \"schema:class\". */\r\n public get classFullName(): string { return this._ctor.classFullName; }\r\n\r\n /** @internal */\r\n public static get protectedOperations(): string[] { return []; }\r\n}\r\n\r\n/** Parameter type that can accept both abstract constructor types and non-abstract constructor types for `instanceof` to test.\r\n * @public\r\n */\r\nexport type EntityClassType<T> = Function & { prototype: T };\r\n"]}
1
+ {"version":3,"file":"Entity.js","sourceRoot":"","sources":["../../src/Entity.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuD;AAEvD,yCAAsC;AAGtC;;;;GAIG;AACH,MAAa,MAAM;IAmCjB,gBAAgB;IAChB,YAAY,KAAkB,EAAE,MAAgB;QAnChD;;WAEG;QACa,uBAAkB,GAAS,IAAI,CAAC;QAiC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,mBAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClC,8EAA8E;QAC9E,IAAI,CAAC,eAAe,CAAC,CAAC,QAAgB,EAAE,IAAsB,EAAE,EAAE,CAAE,IAAY,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,cAAc,CAAE,KAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACrJ,CAAC;IAjCD,IAAY,KAAK,KAAoB,OAAO,IAAI,CAAC,WAA4B,CAAC,CAAC,CAAC;IAEhF;;;;OAIG;IACI,MAAM,KAAK,SAAS,KAAa,OAAO,QAAQ,CAAC,CAAC,CAAC;IAE1D;;;OAGG;IACH,IAAW,KAAK,KAAU,OAAO,IAAI,CAAC,CAAC,CAAC;IAExC,yDAAyD;IACzD,IAAW,UAAU,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAExE,4DAA4D;IAC5D,IAAW,SAAS,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAgB/D;;OAEG;IACI,MAAM;QACX,MAAM,GAAG,GAAQ,EAAE,CAAC;QACpB,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACvC,IAAI,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,eAAe,CAAC,CAAC,QAAgB,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAI,IAAY,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC;QAC3F,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;OAIG;IACI,eAAe,CAAC,IAAsB,EAAE,gBAAyB,IAAI,IAAI,mBAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAEvK,4EAA4E;IACrE,MAAM,KAAK,aAAa,KAAa,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAEnG,6EAA6E;IAC7E,IAAW,aAAa,KAAa,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAEvE,gBAAgB;IACT,MAAM,KAAK,mBAAmB,KAAe,OAAO,EAAE,CAAC,CAAC,CAAC;CACjE;AAtED,wBAsEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Schema\r\n */\r\n\r\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\r\nimport { EntityProps, PropertyCallback, PropertyMetaData } from \"@itwin/core-common\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { Schema } from \"./Schema\";\r\n\r\n/** Represents an entity in an [[IModelDb]] such as an [[Element]], [[Model]], or [[Relationship]].\r\n * Every subclass of Entity represents one BIS [ECClass]($ecschema-metadata).\r\n * An Entity is typically instantiated from an [EntityProps]($common) and can be converted back to this representation via [[Entity.toJSON]].\r\n * @public\r\n */\r\nexport class Entity {\r\n /** An immutable property used to discriminate between [[Entity]] and [EntityProps]($common), used to inform the TypeScript compiler that these two types\r\n * are never substitutable for one another. To obtain an EntityProps from an Entity, use [[Entity.toJSON]].\r\n */\r\n public readonly isInstanceOfEntity: true = true;\r\n /** The Schema that defines this class. */\r\n public static schema: typeof Schema;\r\n\r\n private get _ctor(): typeof Entity { return this.constructor as typeof Entity; }\r\n\r\n /** The name of the BIS class associated with this class.\r\n * @note Every subclass of Entity **MUST** override this method to identify its BIS class.\r\n * Failure to do so will ordinarily result in an error when the class is registered, since there may only\r\n * be one JavaScript class for a given BIS class (usually the errant class will collide with its superclass.)\r\n */\r\n public static get className(): string { return \"Entity\"; }\r\n\r\n /** When working with an Entity it can be useful to set property values directly, bypassing the compiler's type checking.\r\n * This property makes such code slightly less tedious to read and write.\r\n * @internal\r\n */\r\n public get asAny(): any { return this; }\r\n\r\n /** The name of the BIS Schema that defines this class */\r\n public get schemaName(): string { return this._ctor.schema.schemaName; }\r\n\r\n /** The name of the BIS class associated with this class. */\r\n public get className(): string { return this._ctor.className; }\r\n\r\n /** The [[IModelDb]] that contains this Entity */\r\n public iModel: IModelDb;\r\n\r\n /** The Id of this Entity. May be invalid if the Entity has not yet been saved in the database. */\r\n public id: Id64String;\r\n\r\n /** @internal */\r\n constructor(props: EntityProps, iModel: IModelDb) {\r\n this.iModel = iModel;\r\n this.id = Id64.fromJSON(props.id);\r\n // copy all auto-handled properties from input to the object being constructed\r\n this.forEachProperty((propName: string, meta: PropertyMetaData) => (this as any)[propName] = meta.createProperty((props as any)[propName]), false);\r\n }\r\n\r\n /** Obtain the JSON representation of this Entity. Subclasses of [[Entity]] typically override this method to return their corresponding sub-type of [EntityProps]($common) -\r\n * for example, [[GeometricElement.toJSON]] returns a [GeometricElementProps]($common).\r\n */\r\n public toJSON(): EntityProps {\r\n const val: any = {};\r\n val.classFullName = this.classFullName;\r\n if (Id64.isValid(this.id))\r\n val.id = this.id;\r\n this.forEachProperty((propName: string) => val[propName] = (this as any)[propName], false);\r\n return val;\r\n }\r\n\r\n /** Call a function for each property of this Entity.\r\n * @param func The callback to be invoked on each property\r\n * @param includeCustom If true (default), include custom-handled properties in the iteration. Otherwise, skip custom-handled properties.\r\n * @note Custom-handled properties are core properties that have behavior enforced by C++ handlers.\r\n */\r\n public forEachProperty(func: PropertyCallback, includeCustom: boolean = true) { IModelDb.forEachMetaData(this.iModel, this.classFullName, true, func, includeCustom); }\r\n\r\n /** Get the full BIS class name of this Entity in the form \"schema:class\" */\r\n public static get classFullName(): string { return `${this.schema.schemaName}:${this.className}`; }\r\n\r\n /** Get the full BIS class name of this Entity in the form \"schema:class\". */\r\n public get classFullName(): string { return this._ctor.classFullName; }\r\n\r\n /** @internal */\r\n public static get protectedOperations(): string[] { return []; }\r\n}\r\n\r\n/** Parameter type that can accept both abstract constructor types and non-abstract constructor types for `instanceof` to test.\r\n * @public\r\n */\r\nexport type EntityClassType<T> = Function & { prototype: T };\r\n"]}
@@ -101,7 +101,7 @@ export interface ExportPartInstanceInfo {
101
101
  /** The base display properties when the [GeometryPart]($core-backend) was referenced. */
102
102
  displayProps: ExportPartDisplayInfo;
103
103
  /** A row-major storage 4x3 transform for this instance.
104
- * See export-gltf under test-apps in the iModel.js monorepo for a working reference.
104
+ * See export-gltf under test-apps in the iTwin.js monorepo for a working reference.
105
105
  */
106
106
  transform?: Float64Array;
107
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExportGraphics.d.ts","sourceRoot":"","sources":["../../src/ExportGraphics.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,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,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAO/G,6FAA6F;IACtF,YAAY,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAUjE"}
@@ -8,6 +8,7 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ExportGraphicsMeshVisitor = exports.ExportGraphics = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
11
12
  const core_geometry_1 = require("@itwin/core-geometry");
12
13
  /** Provides utility functions for working with data generated by [IModelDb.exportGraphics]($core-backend)
13
14
  * @public
@@ -42,9 +43,11 @@ var ExportGraphics;
42
43
  for (let i = 0; i < p.length; i += 3)
43
44
  polyface.data.point.pushXYZ(p[i], p[i + 1], p[i + 2]);
44
45
  const n = mesh.normals;
46
+ (0, core_bentley_1.assert)(undefined !== polyface.data.normal);
45
47
  for (let i = 0; i < n.length; i += 3)
46
48
  polyface.data.normal.pushXYZ(n[i], n[i + 1], n[i + 2]);
47
49
  const uv = mesh.params;
50
+ (0, core_bentley_1.assert)(undefined !== polyface.data.param);
48
51
  for (let i = 0; i < uv.length; i += 2)
49
52
  polyface.data.param.pushXY(uv[i], uv[i + 1]);
50
53
  const indices = mesh.indices;
@@ -1 +1 @@
1
- {"version":3,"file":"ExportGraphics.js","sourceRoot":"","sources":["../../src/ExportGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAgG;AAkPhG;;GAEG;AACH,IAAiB,cAAc,CAgD9B;AAhDD,WAAiB,cAAc;IAC7B;;OAEG;IACH,SAAgB,wBAAwB,CAAC,GAA0B,EAAE,GAA0B;QAC7F,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU;YAAE,OAAO,KAAK,CAAC;QACpD,IAAI,GAAG,CAAC,aAAa,KAAK,GAAG,CAAC,aAAa;YAAE,OAAO,KAAK,CAAC;QAC1D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K,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;YAC5D,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CAEF;AA5ID,8DA4IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { IndexedPolyface, Polyface, PolyfaceData, PolyfaceVisitor } from \"@itwin/core-geometry\";\r\nimport { GeometryClass } from \"@itwin/core-common\";\r\n\r\n/** A collection of line segments, suitable for direct use with graphics APIs.\r\n * The structure of this data matches GL_LINES in OpenGL.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsLines {\r\n /** Zero-based vertex indices, every two indices represent a line segment */\r\n indices: Int32Array;\r\n /** Vertices for these lines, laid out in the pattern XYZXYZ */\r\n points: Float64Array;\r\n}\r\n\r\n/** Info provided to ExportLinesFunction about linework graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportLinesInfo {\r\n /** The element ID for the element the graphics originated from */\r\n elementId: Id64String;\r\n /** ID for the [SubCategory]($core-backend) for these graphics */\r\n subCategory: Id64String;\r\n /** The color and transparency for these graphics, laid out in TBGR format, see [ColorDef]($core-common) */\r\n color: number;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** The linework for these graphics */\r\n lines: ExportGraphicsLines;\r\n}\r\n\r\n/** A callback function that receives generated line graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportLinesFunction = (info: ExportLinesInfo) => void;\r\n\r\n/** A triangulated mesh with unified indices, suitable for direct use with graphics APIs.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsMesh {\r\n /** Zero-based vertex indices, every three indices represent a triangle */\r\n indices: Int32Array;\r\n /** Vertices for this mesh, laid out in the pattern XYZXYZ */\r\n points: Float64Array;\r\n /** Normals for this mesh, laid out in the pattern XYZXYZ */\r\n normals: Float32Array;\r\n /** Parameters (uvs) for this mesh, laid out in the pattern XYXY */\r\n params: Float32Array;\r\n /** If true, clients should assume both sides of the mesh are visible and not cull backfaces. */\r\n isTwoSided: boolean;\r\n}\r\n\r\n/** Info provided to ExportGraphicsFunction about graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsInfo {\r\n /** The element ID for the element the graphics originated from */\r\n elementId: Id64String;\r\n /** ID for the [SubCategory]($core-backend) for these graphics */\r\n subCategory: Id64String;\r\n /** The color and transparency for these graphics, laid out in TBGR format, see [ColorDef]($core-common) */\r\n color: number;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\r\n materialId?: Id64String;\r\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\r\n textureId?: Id64String;\r\n /** The mesh for these graphics */\r\n mesh: ExportGraphicsMesh;\r\n}\r\n\r\n/** Information about the base display properties when a [GeometryPart]($core-backend) was\r\n * referenced. This is intended to be used with [IModelDb.exportPartGraphics]($core-backend).\r\n * * If two ExportPartInstanceInfo have the same ExportPartDisplayInfos, they will result in the\r\n * same graphics (with a different transform).\r\n * * If two ExportPartInstanceInfo have different ExportPartDisplayInfos, they may result in different\r\n * graphics.\r\n * @public\r\n */\r\nexport interface ExportPartDisplayInfo {\r\n categoryId: Id64String;\r\n subCategoryId: Id64String;\r\n geometryClass: GeometryClass;\r\n materialId: Id64String;\r\n elmTransparency: number;\r\n lineColor: number;\r\n}\r\n\r\n/** Information about references to [GeometryPart]($core-backend) elements found during\r\n * a call to [IModelDb.exportGraphics]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend) for the intended use case.\r\n * @public\r\n */\r\nexport interface ExportPartInstanceInfo {\r\n /** ID for the [GeometryPart]($core-backend) */\r\n partId: Id64String;\r\n /** ID for the element that contained the reference to the [GeometryPart]($core-backend) */\r\n partInstanceId: Id64String;\r\n /** The base display properties when the [GeometryPart]($core-backend) was referenced. */\r\n displayProps: ExportPartDisplayInfo;\r\n /** A row-major storage 4x3 transform for this instance.\r\n * See export-gltf under test-apps in the iModel.js monorepo for a working reference.\r\n */\r\n transform?: Float64Array;\r\n}\r\n\r\n/** A callback function that receives generated graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportGraphicsFunction = (info: ExportGraphicsInfo) => void;\r\n\r\n/** Parameters for [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsOptions {\r\n /** The source elements for the exported graphics */\r\n elementIdArray: Id64Array;\r\n /** A function to call for each unique element ID, color and texture combination */\r\n onGraphics: ExportGraphicsFunction;\r\n /** An optional function to call if line graphics are desired. */\r\n onLineGraphics?: ExportLinesFunction;\r\n /** If supplied, any references to [GeometryPart]($core-backend) elements found will be\r\n * recorded in this array. In this case, graphics that would result from the GeometryPart\r\n * will not be supplied via onGraphics. See [IModelDb.exportPartGraphics]($core-backend)\r\n */\r\n partInstanceArray?: ExportPartInstanceInfo[];\r\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry) */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry) */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry) */\r\n maxEdgeLength?: number;\r\n /** The longest dimension of a line style's largest component must be at least this size in order for\r\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\r\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\r\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\r\n * line strings.\r\n */\r\n minLineStyleComponentSize?: number;\r\n /** Max distance between mesh vertices for them to be collapsed.\r\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\r\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\r\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\r\n * anomalies so it is important to choose an appropriate setting for your use case.\r\n */\r\n decimationTol?: number;\r\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\r\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\r\n * like screws and screw holes.\r\n */\r\n minBRepFeatureSize?: number;\r\n}\r\n\r\n/** Info provided to ExportPartFunction about graphics.\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartInfo {\r\n /** The color and transparency for these graphics, laid out in TBGR format, see [ColorDef]($core-common) */\r\n color: number;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\r\n materialId?: Id64String;\r\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\r\n textureId?: Id64String;\r\n /** The mesh for these graphics */\r\n mesh: ExportGraphicsMesh;\r\n}\r\n\r\n/** A callback function that receives generated graphics for a [GeometryPart]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportPartFunction = (info: ExportPartInfo) => void;\r\n\r\n/** Info provided to ExportPartFunction about line graphics.\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartLinesInfo {\r\n /** The color and transparency for these graphics, laid out in TBGR format, see [ColorDef]($core-common) */\r\n color: number;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** The linework for these graphics */\r\n lines: ExportGraphicsLines;\r\n}\r\n\r\n/** A callback function that receives generated line graphics for a [GeometryPart]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportPartLinesFunction = (info: ExportPartLinesInfo) => void;\r\n\r\n/** Parameters for [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartGraphicsOptions {\r\n /** The ID for the source [GeometryPart]($core-backend) */\r\n elementId: Id64String;\r\n /** The base display properties to use for generating the graphics. This should come from an\r\n * ExportPartInstanceProps generated by [IModelDb.exportGraphics]($core-backend)\r\n */\r\n displayProps: ExportPartDisplayInfo;\r\n /** A function to call for each unique color and texture combination. */\r\n onPartGraphics: ExportPartFunction;\r\n /** An optional function to call if line graphics are desired. */\r\n onPartLineGraphics?: ExportPartLinesFunction;\r\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry) */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry) */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry) */\r\n maxEdgeLength?: number;\r\n /** The longest dimension of a line style's largest component must be at least this size in order for\r\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\r\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\r\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\r\n * line strings.\r\n */\r\n minLineStyleComponentSize?: number;\r\n /** Max distance between mesh vertices for them to be collapsed.\r\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\r\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\r\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\r\n * anomalies so it is important to choose an appropriate setting for your use case.\r\n */\r\n decimationTol?: number;\r\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\r\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\r\n * like screws and screw holes.\r\n */\r\n minBRepFeatureSize?: number;\r\n}\r\n\r\n/** Provides utility functions for working with data generated by [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport namespace ExportGraphics {\r\n /** Test if ExportPartDisplayInfos have exactly the same values.\r\n * @public\r\n */\r\n export function arePartDisplayInfosEqual(lhs: ExportPartDisplayInfo, rhs: ExportPartDisplayInfo): boolean {\r\n if (lhs.categoryId !== rhs.categoryId) return false;\r\n if (lhs.subCategoryId !== rhs.subCategoryId) return false;\r\n if (lhs.materialId !== rhs.materialId) return false;\r\n if (lhs.elmTransparency !== rhs.elmTransparency) return false;\r\n if (lhs.lineColor !== rhs.lineColor) return false;\r\n return true;\r\n }\r\n\r\n /**\r\n * Convert an ExportGraphicsMesh to an IndexedPolyface usable by the geometry API.\r\n * @note The resulting IndexedPolyface may have duplicate points, normals and params. If problematic, call [PolyfaceData.compress]($core-geometry)\r\n * @public\r\n */\r\n export function convertToIndexedPolyface(mesh: ExportGraphicsMesh): IndexedPolyface {\r\n const polyface = IndexedPolyface.create(true, true, false, mesh.isTwoSided);\r\n\r\n const p: Float64Array = mesh.points;\r\n for (let i = 0; i < p.length; i += 3)\r\n polyface.data.point.pushXYZ(p[i], p[i + 1], p[i + 2]);\r\n\r\n const n: Float32Array = mesh.normals;\r\n for (let i = 0; i < n.length; i += 3)\r\n polyface.data.normal!.pushXYZ(n[i], n[i + 1], n[i + 2]);\r\n\r\n const uv: Float32Array = mesh.params;\r\n for (let i = 0; i < uv.length; i += 2)\r\n polyface.data.param!.pushXY(uv[i], uv[i + 1]);\r\n\r\n const indices = mesh.indices;\r\n const addIndex = (idx: number) => {\r\n polyface.addPointIndex(idx, true);\r\n polyface.addNormalIndex(idx);\r\n polyface.addParamIndex(idx);\r\n };\r\n for (let i = 0; i < indices.length; i += 3) {\r\n addIndex(indices[i]);\r\n addIndex(indices[i + 1]);\r\n addIndex(indices[i + 2]);\r\n polyface.terminateFacet(false);\r\n }\r\n\r\n return polyface;\r\n }\r\n}\r\n/**\r\n * * Iterator to walk the facets of an ExportGraphicsMesh and present them to the world as if visiting a Polyface.\r\n * * Because the ExportGraphicsMesh has limited data:\r\n * * There is no auxData in this visitor.\r\n * * There is no color in this visitor.\r\n * * All edgeVisible are true.\r\n * @public\r\n */\r\nexport class ExportGraphicsMeshVisitor extends PolyfaceData implements PolyfaceVisitor {\r\n private _currentFacetIndex: number;\r\n private _nextFacetIndex: number;\r\n private _numWrap: number;\r\n private _polyface: ExportGraphicsMesh;\r\n // to be called from static factory method that validates the polyface ...\r\n private constructor(facets: ExportGraphicsMesh, numWrap: number) {\r\n super(facets.normals.length > 0, facets.params.length > 0, false, facets.isTwoSided);\r\n this._polyface = facets;\r\n this._numWrap = numWrap;\r\n\r\n this._nextFacetIndex = 0;\r\n this._currentFacetIndex = -1;\r\n this.twoSided = facets.isTwoSided;\r\n this.reset();\r\n }\r\n /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\r\n * Typical wrap counts are:\r\n * * 0 -- leave the point arrays with \"missing final edge\"\r\n * * 1 -- add point 0 as closure point\r\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\r\n */\r\n public static create(polyface: ExportGraphicsMesh, numWrap: number): ExportGraphicsMeshVisitor {\r\n return new ExportGraphicsMeshVisitor(polyface, numWrap);\r\n }\r\n /** Reset the iterator to start at the first facet of the polyface. */\r\n public reset(): void {\r\n this.moveToReadIndex(0);\r\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\r\n }\r\n /** Select a facet by simple index. */\r\n public moveToReadIndex(facetIndex: number): boolean {\r\n if (facetIndex < 0 || 2 + facetIndex * 3 >= this._polyface.indices.length)\r\n return false;\r\n this._currentFacetIndex = facetIndex;\r\n this._nextFacetIndex = facetIndex + 1;\r\n this.point.length = 0;\r\n const points = this.point;\r\n points.length = 0;\r\n this.pointIndex.length = 0;\r\n this.point.length = 0;\r\n this.edgeVisible.length = 0;\r\n const sourcePoints = this._polyface.points;\r\n const indices = this._polyface.indices;\r\n const i0 = 3 * facetIndex;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 3 * indices[i];\r\n this.pointIndex.push(indices[i]);\r\n this.point.pushXYZ(sourcePoints[k], sourcePoints[k + 1], sourcePoints[k + 2]);\r\n this.edgeVisible.push(true);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.point.pushFromGrowableXYZArray(this.point, i);\r\n }\r\n\r\n const sourceParams = this._polyface.params;\r\n if (sourceParams.length > 0 && this.paramIndex && this.param) {\r\n this.paramIndex.length = 0;\r\n this.param.length = 0;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 2 * indices[i];\r\n this.paramIndex.push(indices[i]);\r\n this.param.pushXY(sourceParams[k], sourceParams[k + 1]);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.param.pushFromGrowableXYArray(this.param, i);\r\n }\r\n }\r\n\r\n const sourceNormals = this._polyface.normals;\r\n if (sourceNormals.length > 0 && this.normalIndex && this.normal) {\r\n this.normalIndex.length = 0;\r\n this.normal.length = 0;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 3 * indices[i];\r\n this.normalIndex.push(indices[i]);\r\n this.normal.pushXYZ(sourceNormals[k], sourceNormals[k + 1], sourceNormals[k + 2]);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.normal.pushFromGrowableXYZArray(this.normal, i);\r\n }\r\n }\r\n return true;\r\n }\r\n public moveToNextFacet(): boolean {\r\n return this.moveToReadIndex(this._nextFacetIndex);\r\n }\r\n /** Set the number of vertices to replicate in visitor arrays. */\r\n public setNumWrap(numWrap: number): void { this._numWrap = numWrap; }\r\n\r\n /** Return the index (in the client polyface) of the current facet */\r\n public currentReadIndex(): number { return this._currentFacetIndex; }\r\n /** Return the point index of vertex i within the currently loaded facet */\r\n public clientPointIndex(i: number): number { return this.pointIndex[i]; }\r\n /** Return the param index of vertex i within the currently loaded facet.\r\n * Use the artificial paramIndex, which matches pointIndex.\r\n */\r\n public clientParamIndex(i: number): number { return this.paramIndex ? this.paramIndex[i] : -1; }\r\n /** Return the normal index of vertex i within the currently loaded facet.\r\n * Use the artificial paramIndex, which matches pointIndex.\r\n */\r\n public clientNormalIndex(i: number): number { return this.normalIndex ? this.normalIndex[i] : -1; }\r\n /** Return the color index of vertex i within the currently loaded facet */\r\n public clientColorIndex(_i: number): number { return 1; }\r\n /** Return the aux data index of vertex i within the currently loaded facet */\r\n public clientAuxIndex(_i: number): number { return -1; }\r\n\r\n /** return the client polyface */\r\n public clientPolyface(): Polyface { return (undefined as unknown) as Polyface; }\r\n /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */\r\n public clearArrays(): void {\r\n if (this.point !== undefined)\r\n this.point.length = 0;\r\n if (this.param !== undefined)\r\n this.param.length = 0;\r\n if (this.normal !== undefined)\r\n this.normal.length = 0;\r\n // ignore color and aux -- they never exist.\r\n }\r\n /** transfer interpolated data from the other visitor.\r\n * * all data values are interpolated at `fraction` between `other` values at index0 and index1.\r\n */\r\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\r\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\r\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\r\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\r\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\r\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\r\n }\r\n /** transfer data from a specified index of the other visitor as new data in this visitor. */\r\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\r\n this.point.pushFromGrowableXYZArray(other.point, index);\r\n if (this.color && other.color && index < other.color.length)\r\n this.color.push(other.color[index]);\r\n if (this.param && other.param && index < other.param.length)\r\n this.param.pushFromGrowableXYArray(other.param, index);\r\n if (this.normal && other.normal && index < other.normal.length)\r\n this.normal.pushFromGrowableXYZArray(other.normal, index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YAC7F,IAAI,CAAC,MAAM,CAAC,oCAAoC,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7F,CAAC;IACD,6FAA6F;IACtF,YAAY,CAAC,KAAsB,EAAE,KAAa;QACvD,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACxD,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM;YACzD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACtC,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM;YACzD,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM;YAC5D,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CAEF;AA5ID,8DA4IC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module iModels\r\n */\r\n\r\nimport { assert, Id64Array, Id64String } from \"@itwin/core-bentley\";\r\nimport { IndexedPolyface, Polyface, PolyfaceData, PolyfaceVisitor } from \"@itwin/core-geometry\";\r\nimport { GeometryClass } from \"@itwin/core-common\";\r\n\r\n/** A collection of line segments, suitable for direct use with graphics APIs.\r\n * The structure of this data matches GL_LINES in OpenGL.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsLines {\r\n /** Zero-based vertex indices, every two indices represent a line segment */\r\n indices: Int32Array;\r\n /** Vertices for these lines, laid out in the pattern XYZXYZ */\r\n points: Float64Array;\r\n}\r\n\r\n/** Info provided to ExportLinesFunction about linework graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportLinesInfo {\r\n /** The element ID for the element the graphics originated from */\r\n elementId: Id64String;\r\n /** ID for the [SubCategory]($core-backend) for these graphics */\r\n subCategory: Id64String;\r\n /** The color and transparency for these graphics, laid out in TBGR format, see [ColorDef]($core-common) */\r\n color: number;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** The linework for these graphics */\r\n lines: ExportGraphicsLines;\r\n}\r\n\r\n/** A callback function that receives generated line graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportLinesFunction = (info: ExportLinesInfo) => void;\r\n\r\n/** A triangulated mesh with unified indices, suitable for direct use with graphics APIs.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsMesh {\r\n /** Zero-based vertex indices, every three indices represent a triangle */\r\n indices: Int32Array;\r\n /** Vertices for this mesh, laid out in the pattern XYZXYZ */\r\n points: Float64Array;\r\n /** Normals for this mesh, laid out in the pattern XYZXYZ */\r\n normals: Float32Array;\r\n /** Parameters (uvs) for this mesh, laid out in the pattern XYXY */\r\n params: Float32Array;\r\n /** If true, clients should assume both sides of the mesh are visible and not cull backfaces. */\r\n isTwoSided: boolean;\r\n}\r\n\r\n/** Info provided to ExportGraphicsFunction about graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsInfo {\r\n /** The element ID for the element the graphics originated from */\r\n elementId: Id64String;\r\n /** ID for the [SubCategory]($core-backend) for these graphics */\r\n subCategory: Id64String;\r\n /** The color and transparency for these graphics, laid out in TBGR format, see [ColorDef]($core-common) */\r\n color: number;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\r\n materialId?: Id64String;\r\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\r\n textureId?: Id64String;\r\n /** The mesh for these graphics */\r\n mesh: ExportGraphicsMesh;\r\n}\r\n\r\n/** Information about the base display properties when a [GeometryPart]($core-backend) was\r\n * referenced. This is intended to be used with [IModelDb.exportPartGraphics]($core-backend).\r\n * * If two ExportPartInstanceInfo have the same ExportPartDisplayInfos, they will result in the\r\n * same graphics (with a different transform).\r\n * * If two ExportPartInstanceInfo have different ExportPartDisplayInfos, they may result in different\r\n * graphics.\r\n * @public\r\n */\r\nexport interface ExportPartDisplayInfo {\r\n categoryId: Id64String;\r\n subCategoryId: Id64String;\r\n geometryClass: GeometryClass;\r\n materialId: Id64String;\r\n elmTransparency: number;\r\n lineColor: number;\r\n}\r\n\r\n/** Information about references to [GeometryPart]($core-backend) elements found during\r\n * a call to [IModelDb.exportGraphics]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend) for the intended use case.\r\n * @public\r\n */\r\nexport interface ExportPartInstanceInfo {\r\n /** ID for the [GeometryPart]($core-backend) */\r\n partId: Id64String;\r\n /** ID for the element that contained the reference to the [GeometryPart]($core-backend) */\r\n partInstanceId: Id64String;\r\n /** The base display properties when the [GeometryPart]($core-backend) was referenced. */\r\n displayProps: ExportPartDisplayInfo;\r\n /** A row-major storage 4x3 transform for this instance.\r\n * See export-gltf under test-apps in the iTwin.js monorepo for a working reference.\r\n */\r\n transform?: Float64Array;\r\n}\r\n\r\n/** A callback function that receives generated graphics.\r\n * See [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportGraphicsFunction = (info: ExportGraphicsInfo) => void;\r\n\r\n/** Parameters for [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportGraphicsOptions {\r\n /** The source elements for the exported graphics */\r\n elementIdArray: Id64Array;\r\n /** A function to call for each unique element ID, color and texture combination */\r\n onGraphics: ExportGraphicsFunction;\r\n /** An optional function to call if line graphics are desired. */\r\n onLineGraphics?: ExportLinesFunction;\r\n /** If supplied, any references to [GeometryPart]($core-backend) elements found will be\r\n * recorded in this array. In this case, graphics that would result from the GeometryPart\r\n * will not be supplied via onGraphics. See [IModelDb.exportPartGraphics]($core-backend)\r\n */\r\n partInstanceArray?: ExportPartInstanceInfo[];\r\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry) */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry) */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry) */\r\n maxEdgeLength?: number;\r\n /** The longest dimension of a line style's largest component must be at least this size in order for\r\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\r\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\r\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\r\n * line strings.\r\n */\r\n minLineStyleComponentSize?: number;\r\n /** Max distance between mesh vertices for them to be collapsed.\r\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\r\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\r\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\r\n * anomalies so it is important to choose an appropriate setting for your use case.\r\n */\r\n decimationTol?: number;\r\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\r\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\r\n * like screws and screw holes.\r\n */\r\n minBRepFeatureSize?: number;\r\n}\r\n\r\n/** Info provided to ExportPartFunction about graphics.\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartInfo {\r\n /** The color and transparency for these graphics, laid out in TBGR format, see [ColorDef]($core-common) */\r\n color: number;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\r\n materialId?: Id64String;\r\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\r\n textureId?: Id64String;\r\n /** The mesh for these graphics */\r\n mesh: ExportGraphicsMesh;\r\n}\r\n\r\n/** A callback function that receives generated graphics for a [GeometryPart]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportPartFunction = (info: ExportPartInfo) => void;\r\n\r\n/** Info provided to ExportPartFunction about line graphics.\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartLinesInfo {\r\n /** The color and transparency for these graphics, laid out in TBGR format, see [ColorDef]($core-common) */\r\n color: number;\r\n /** GeometryClass for these graphics */\r\n geometryClass: GeometryClass;\r\n /** The linework for these graphics */\r\n lines: ExportGraphicsLines;\r\n}\r\n\r\n/** A callback function that receives generated line graphics for a [GeometryPart]($core-backend).\r\n * See [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport type ExportPartLinesFunction = (info: ExportPartLinesInfo) => void;\r\n\r\n/** Parameters for [IModelDb.exportPartGraphics]($core-backend)\r\n * @public\r\n */\r\nexport interface ExportPartGraphicsOptions {\r\n /** The ID for the source [GeometryPart]($core-backend) */\r\n elementId: Id64String;\r\n /** The base display properties to use for generating the graphics. This should come from an\r\n * ExportPartInstanceProps generated by [IModelDb.exportGraphics]($core-backend)\r\n */\r\n displayProps: ExportPartDisplayInfo;\r\n /** A function to call for each unique color and texture combination. */\r\n onPartGraphics: ExportPartFunction;\r\n /** An optional function to call if line graphics are desired. */\r\n onPartLineGraphics?: ExportPartLinesFunction;\r\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry) */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry) */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry) */\r\n maxEdgeLength?: number;\r\n /** The longest dimension of a line style's largest component must be at least this size in order for\r\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\r\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\r\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\r\n * line strings.\r\n */\r\n minLineStyleComponentSize?: number;\r\n /** Max distance between mesh vertices for them to be collapsed.\r\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\r\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\r\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\r\n * anomalies so it is important to choose an appropriate setting for your use case.\r\n */\r\n decimationTol?: number;\r\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\r\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\r\n * like screws and screw holes.\r\n */\r\n minBRepFeatureSize?: number;\r\n}\r\n\r\n/** Provides utility functions for working with data generated by [IModelDb.exportGraphics]($core-backend)\r\n * @public\r\n */\r\nexport namespace ExportGraphics {\r\n /** Test if ExportPartDisplayInfos have exactly the same values.\r\n * @public\r\n */\r\n export function arePartDisplayInfosEqual(lhs: ExportPartDisplayInfo, rhs: ExportPartDisplayInfo): boolean {\r\n if (lhs.categoryId !== rhs.categoryId) return false;\r\n if (lhs.subCategoryId !== rhs.subCategoryId) return false;\r\n if (lhs.materialId !== rhs.materialId) return false;\r\n if (lhs.elmTransparency !== rhs.elmTransparency) return false;\r\n if (lhs.lineColor !== rhs.lineColor) return false;\r\n return true;\r\n }\r\n\r\n /**\r\n * Convert an ExportGraphicsMesh to an IndexedPolyface usable by the geometry API.\r\n * @note The resulting IndexedPolyface may have duplicate points, normals and params. If problematic, call [PolyfaceData.compress]($core-geometry)\r\n * @public\r\n */\r\n export function convertToIndexedPolyface(mesh: ExportGraphicsMesh): IndexedPolyface {\r\n const polyface = IndexedPolyface.create(true, true, false, mesh.isTwoSided);\r\n\r\n const p: Float64Array = mesh.points;\r\n for (let i = 0; i < p.length; i += 3)\r\n polyface.data.point.pushXYZ(p[i], p[i + 1], p[i + 2]);\r\n\r\n const n: Float32Array = mesh.normals;\r\n assert(undefined !== polyface.data.normal);\r\n for (let i = 0; i < n.length; i += 3)\r\n polyface.data.normal.pushXYZ(n[i], n[i + 1], n[i + 2]);\r\n\r\n const uv: Float32Array = mesh.params;\r\n assert(undefined !== polyface.data.param);\r\n for (let i = 0; i < uv.length; i += 2)\r\n polyface.data.param.pushXY(uv[i], uv[i + 1]);\r\n\r\n const indices = mesh.indices;\r\n const addIndex = (idx: number) => {\r\n polyface.addPointIndex(idx, true);\r\n polyface.addNormalIndex(idx);\r\n polyface.addParamIndex(idx);\r\n };\r\n for (let i = 0; i < indices.length; i += 3) {\r\n addIndex(indices[i]);\r\n addIndex(indices[i + 1]);\r\n addIndex(indices[i + 2]);\r\n polyface.terminateFacet(false);\r\n }\r\n\r\n return polyface;\r\n }\r\n}\r\n/**\r\n * * Iterator to walk the facets of an ExportGraphicsMesh and present them to the world as if visiting a Polyface.\r\n * * Because the ExportGraphicsMesh has limited data:\r\n * * There is no auxData in this visitor.\r\n * * There is no color in this visitor.\r\n * * All edgeVisible are true.\r\n * @public\r\n */\r\nexport class ExportGraphicsMeshVisitor extends PolyfaceData implements PolyfaceVisitor {\r\n private _currentFacetIndex: number;\r\n private _nextFacetIndex: number;\r\n private _numWrap: number;\r\n private _polyface: ExportGraphicsMesh;\r\n // to be called from static factory method that validates the polyface ...\r\n private constructor(facets: ExportGraphicsMesh, numWrap: number) {\r\n super(facets.normals.length > 0, facets.params.length > 0, false, facets.isTwoSided);\r\n this._polyface = facets;\r\n this._numWrap = numWrap;\r\n\r\n this._nextFacetIndex = 0;\r\n this._currentFacetIndex = -1;\r\n this.twoSided = facets.isTwoSided;\r\n this.reset();\r\n }\r\n /** Create a visitor for iterating the facets of `polyface`, with indicated number of points to be added to each facet to produce closed point arrays\r\n * Typical wrap counts are:\r\n * * 0 -- leave the point arrays with \"missing final edge\"\r\n * * 1 -- add point 0 as closure point\r\n * * 2 -- add points 0 and 1 as closure and wrap point. This is useful when vertex visit requires two adjacent vectors, e.g. for cross products.\r\n */\r\n public static create(polyface: ExportGraphicsMesh, numWrap: number): ExportGraphicsMeshVisitor {\r\n return new ExportGraphicsMeshVisitor(polyface, numWrap);\r\n }\r\n /** Reset the iterator to start at the first facet of the polyface. */\r\n public reset(): void {\r\n this.moveToReadIndex(0);\r\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\r\n }\r\n /** Select a facet by simple index. */\r\n public moveToReadIndex(facetIndex: number): boolean {\r\n if (facetIndex < 0 || 2 + facetIndex * 3 >= this._polyface.indices.length)\r\n return false;\r\n this._currentFacetIndex = facetIndex;\r\n this._nextFacetIndex = facetIndex + 1;\r\n this.point.length = 0;\r\n const points = this.point;\r\n points.length = 0;\r\n this.pointIndex.length = 0;\r\n this.point.length = 0;\r\n this.edgeVisible.length = 0;\r\n const sourcePoints = this._polyface.points;\r\n const indices = this._polyface.indices;\r\n const i0 = 3 * facetIndex;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 3 * indices[i];\r\n this.pointIndex.push(indices[i]);\r\n this.point.pushXYZ(sourcePoints[k], sourcePoints[k + 1], sourcePoints[k + 2]);\r\n this.edgeVisible.push(true);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.point.pushFromGrowableXYZArray(this.point, i);\r\n }\r\n\r\n const sourceParams = this._polyface.params;\r\n if (sourceParams.length > 0 && this.paramIndex && this.param) {\r\n this.paramIndex.length = 0;\r\n this.param.length = 0;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 2 * indices[i];\r\n this.paramIndex.push(indices[i]);\r\n this.param.pushXY(sourceParams[k], sourceParams[k + 1]);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.param.pushFromGrowableXYArray(this.param, i);\r\n }\r\n }\r\n\r\n const sourceNormals = this._polyface.normals;\r\n if (sourceNormals.length > 0 && this.normalIndex && this.normal) {\r\n this.normalIndex.length = 0;\r\n this.normal.length = 0;\r\n for (let i = i0; i < i0 + 3; i++) {\r\n const k = 3 * indices[i];\r\n this.normalIndex.push(indices[i]);\r\n this.normal.pushXYZ(sourceNormals[k], sourceNormals[k + 1], sourceNormals[k + 2]);\r\n }\r\n for (let i = 0; i < this._numWrap; i++) {\r\n this.normal.pushFromGrowableXYZArray(this.normal, i);\r\n }\r\n }\r\n return true;\r\n }\r\n public moveToNextFacet(): boolean {\r\n return this.moveToReadIndex(this._nextFacetIndex);\r\n }\r\n /** Set the number of vertices to replicate in visitor arrays. */\r\n public setNumWrap(numWrap: number): void { this._numWrap = numWrap; }\r\n\r\n /** Return the index (in the client polyface) of the current facet */\r\n public currentReadIndex(): number { return this._currentFacetIndex; }\r\n /** Return the point index of vertex i within the currently loaded facet */\r\n public clientPointIndex(i: number): number { return this.pointIndex[i]; }\r\n /** Return the param index of vertex i within the currently loaded facet.\r\n * Use the artificial paramIndex, which matches pointIndex.\r\n */\r\n public clientParamIndex(i: number): number { return this.paramIndex ? this.paramIndex[i] : -1; }\r\n /** Return the normal index of vertex i within the currently loaded facet.\r\n * Use the artificial paramIndex, which matches pointIndex.\r\n */\r\n public clientNormalIndex(i: number): number { return this.normalIndex ? this.normalIndex[i] : -1; }\r\n /** Return the color index of vertex i within the currently loaded facet */\r\n public clientColorIndex(_i: number): number { return 1; }\r\n /** Return the aux data index of vertex i within the currently loaded facet */\r\n public clientAuxIndex(_i: number): number { return -1; }\r\n\r\n /** return the client polyface */\r\n public clientPolyface(): Polyface { return (undefined as unknown) as Polyface; }\r\n /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */\r\n public clearArrays(): void {\r\n if (this.point !== undefined)\r\n this.point.length = 0;\r\n if (this.param !== undefined)\r\n this.param.length = 0;\r\n if (this.normal !== undefined)\r\n this.normal.length = 0;\r\n // ignore color and aux -- they never exist.\r\n }\r\n /** transfer interpolated data from the other visitor.\r\n * * all data values are interpolated at `fraction` between `other` values at index0 and index1.\r\n */\r\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\r\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\r\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\r\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\r\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\r\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\r\n }\r\n /** transfer data from a specified index of the other visitor as new data in this visitor. */\r\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\r\n this.point.pushFromGrowableXYZArray(other.point, index);\r\n if (this.color && other.color && index < other.color.length)\r\n this.color.push(other.color[index]);\r\n if (this.param && other.param && index < other.param.length)\r\n this.param.pushFromGrowableXYArray(other.param, index);\r\n if (this.normal && other.normal && index < other.normal.length)\r\n this.normal.pushFromGrowableXYZArray(other.normal, index);\r\n }\r\n\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"GeometrySummary.d.ts","sourceRoot":"","sources":["../../src/GeometrySummary.ts"],"names":[],"mappings":"AAYA,OAAO,EACwE,2BAA2B,EAEzG,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAqZtC,gBAAgB;AAChB,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,QAAQ,GAAG,MAAM,CAGxG"}
1
+ {"version":3,"file":"GeometrySummary.d.ts","sourceRoot":"","sources":["../../src/GeometrySummary.ts"],"names":[],"mappings":"AAYA,OAAO,EAC+C,2BAA2B,EAEhF,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAuZtC,gBAAgB;AAChB,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,QAAQ,GAAG,MAAM,CAGxG"}
@@ -98,10 +98,13 @@ class ResponseGenerator {
98
98
  let geometricElement;
99
99
  if (elem instanceof Element_1.GeometricElement) {
100
100
  geometricElement = elem;
101
- if (geometricElement.is2d())
101
+ if (geometricElement.is2d()) {
102
102
  iterator = core_common_1.GeometryStreamIterator.fromGeometricElement2d(geometricElement);
103
- else
103
+ }
104
+ else {
105
+ (0, core_bentley_1.assert)(geometricElement.is3d());
104
106
  iterator = core_common_1.GeometryStreamIterator.fromGeometricElement3d(geometricElement);
107
+ }
105
108
  }
106
109
  else if (elem instanceof Element_1.GeometryPart) {
107
110
  iterator = core_common_1.GeometryStreamIterator.fromGeometryPart(elem);
@@ -1 +1 @@
1
- {"version":3,"file":"GeometrySummary.js","sourceRoot":"","sources":["../../src/GeometrySummary.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAwF;AACxF,wDAK8B;AAC9B,oDAG4B;AAC5B,uCAAoE;AAQpE,uBAAuB;AAEvB,yDAAyD;AACzD,MAAM,iBAAiB;IAUrB,YAAmB,OAAoC,EAAE,MAAgB;QATlE,cAAS,GAAG,sCAAwB,CAAC,KAAK,CAAC;QAC3C,qBAAgB,GAAG,KAAK,CAAC;QAEzB,qBAAgB,GAAG,KAAK,CAAC;QAO9B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;QAC7B,IAAI,SAAS,KAAK,IAAI,EAAE;YACtB,IAAI,CAAC,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,sCAAwB,CAAC,KAAK,CAAC;YAChH,IAAI,CAAC,gBAAgB,GAAG,IAAI,KAAK,IAAI,CAAC,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,GAAG,OAAO;yBACH,KAAK,CAAC,WAAW,EAAE;oBACxB,IAAI,CAAC,UAAU,EAAE,CAAC;gBAC9B,OAAO,OAAO,CAAC;SAClB;IACH,CAAC;IAEM,wBAAwB,CAAC,MAAuB;QACrD,IAAI,OAAO,GAAW,EAAE,CAAC;QACzB,QAAQ,MAAM,CAAC,mBAAmB,EAAE;YAClC,KAAK,MAAM;gBACT,MAAM,IAAI,GAAS,MAAc,CAAC;gBAClC,OAAO,GAAG,GAAG,OAAO,aAAa,IAAI,CAAC,OAAO,EAAE,CAAC;gBAChD,MAAM;YACR,KAAK,MAAM;gBACT,MAAM,IAAI,GAAS,MAAc,CAAC;gBAClC,OAAO,GAAG,GAAG,OAAO,YAAY,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClD,MAAM;SACT;QAED,OAAO,GAAG,OAAO;mBACF,MAAM,CAAC,sBAAsB,EAAE,CAAC,MAAM;kBACvC,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC;IAC3C,CAAC;CACF;AAED,gBAAgB;AAChB,SAAgB,yBAAyB,CAAC,OAAoC,EAAE,MAAgB;IAC9F,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,iBAAiB,EAAE,CAAC;AACvC,CAAC;AAHD,8DAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { BentleyError, Id64Array, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n AkimaCurve3d, AnyGeometryQuery, Arc3d, BezierCurveBase, Box, BSplineCurve3d, Cone, CurveChainWithDistanceIndex, CurveCollection, CurvePrimitive, IModelJson,\r\n InterpolationCurve3d,\r\n LinearSweep, LineSegment3d, LineString3d, Loop, Path, Range3d, RotationalSweep, RuledSweep, SolidPrimitive, Sphere, TorusPipe, Transform,\r\n TransitionSpiral3d, UVSelect,\r\n} from \"@itwin/core-geometry\";\r\nimport {\r\n BRepEntity, GeometricElement3dProps, GeometryParams, GeometryStreamIterator, GeometrySummaryRequestProps, GeometrySummaryVerbosity, ImagePrimitive,\r\n IModelError, TextStringPrimitive,\r\n} from \"@itwin/core-common\";\r\nimport { Element, GeometricElement, GeometryPart } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\ninterface ElementGeom {\r\n iterator: GeometryStreamIterator;\r\n geometricElement?: GeometricElement;\r\n}\r\n\r\n// cspell:ignore earlin\r\n\r\n/** Generates an array of GeometryStreamResponseProps. */\r\nclass ResponseGenerator {\r\n public verbosity = GeometrySummaryVerbosity.Basic;\r\n public includePlacement = false;\r\n public includePartReferences?: \"2d\" | \"3d\";\r\n public verboseSymbology = false;\r\n public elementIds: Id64Array;\r\n public iModel: IModelDb;\r\n\r\n public get wantSquish() { return GeometrySummaryVerbosity.Full !== this.verbosity; }\r\n\r\n public constructor(request: GeometrySummaryRequestProps, iModel: IModelDb) {\r\n this.elementIds = request.elementIds;\r\n this.iModel = iModel;\r\n const opts = request.options;\r\n if (undefined !== opts) {\r\n this.verbosity = undefined !== opts.geometryVerbosity ? opts.geometryVerbosity : GeometrySummaryVerbosity.Basic;\r\n this.includePlacement = true === opts.includePlacement;\r\n this.includePartReferences = opts.includePartReferences;\r\n this.verboseSymbology = true === opts.verboseSymbology;\r\n }\r\n }\r\n\r\n public generateSummaries(): string {\r\n const summaries: string[] = [];\r\n for (const elementId of this.elementIds)\r\n summaries.push(this.generateSummary(elementId));\r\n\r\n return summaries.join(\"\\n\");\r\n }\r\n\r\n public generateSummary(id: Id64String): string {\r\n let lines = [`[Geometry Summary for Element ${id}]`];\r\n try {\r\n const geom = this.getElementGeom(id);\r\n if (undefined === geom)\r\n throw new IModelError(IModelStatus.NoGeometry, \"Element is neither a geometric element nor a geometry part\");\r\n\r\n if (undefined !== geom.geometricElement)\r\n lines.push(this.summarizeElement(geom.geometricElement));\r\n else if (undefined !== this.includePartReferences)\r\n lines.push(this.summarizePartReferences(id, \"2d\" === this.includePartReferences)); // NB: Hideously inefficient if more than one element's summary was requested.\r\n\r\n let curGeomParams: GeometryParams | undefined;\r\n let curLocalRange: Range3d | undefined;\r\n for (const entry of geom.iterator) {\r\n if (this.verboseSymbology && (undefined === curGeomParams || !curGeomParams.isEquivalent(entry.geomParams))) {\r\n lines.push(`Symbology: ${this.stringify(entry.geomParams)}`);\r\n curGeomParams = entry.geomParams.clone();\r\n }\r\n\r\n if (undefined !== entry.localRange && (undefined === curLocalRange || !curLocalRange.isAlmostEqual(entry.localRange))) {\r\n lines.push(this.summarizeRange3d(entry.localRange));\r\n curLocalRange = entry.localRange;\r\n }\r\n\r\n const prim = entry.primitive;\r\n switch (prim.type) {\r\n case \"textString\":\r\n case \"image\":\r\n this.summarizePrimitive(lines, prim);\r\n break;\r\n case \"brep\":\r\n this.summarizeBRep(lines, prim.brep);\r\n break;\r\n case \"geometryQuery\":\r\n this.summarizeGeometryQuery(lines, prim.geometry);\r\n break;\r\n case \"partReference\":\r\n lines.push(this.summarizePartReference(prim.part.id, prim.part.toLocal));\r\n break;\r\n }\r\n }\r\n } catch (err) {\r\n lines = lines.slice(0, 1);\r\n lines.push(`ERROR: ${BentleyError.getErrorMessage(err)}`);\r\n }\r\n\r\n return lines.filter((line) => line !== \"\").join(\"\\n\");\r\n }\r\n\r\n public summarizeElement(elem: GeometricElement): string {\r\n const lines: string[] = [];\r\n lines.push(`(${elem.is2d() ? \"2D\" : \"3D\"}) Category: ${elem.category}`);\r\n lines.push(`Model: ${elem.model}`);\r\n if (this.includePlacement) {\r\n lines.push(`Range: ${this.stringify(elem.calculateRange3d())}`);\r\n lines.push(`Transform: ${this.stringify(elem.getPlacementTransform())}`);\r\n }\r\n\r\n return lines.join(\"\\n\");\r\n }\r\n\r\n public summarizePartReferences(id: Id64String, is2d: boolean): string {\r\n const refIds = this.iModel.nativeDb.findGeometryPartReferences([id], is2d);\r\n return `Part references (${refIds.length}): ${refIds.join()}`;\r\n }\r\n\r\n public getElementGeom(id: Id64String): ElementGeom | undefined {\r\n const elem = this.iModel.elements.getElement<Element>({ id, wantGeometry: true });\r\n let iterator: GeometryStreamIterator | undefined;\r\n let geometricElement: GeometricElement | undefined;\r\n if (elem instanceof GeometricElement) {\r\n geometricElement = elem;\r\n if (geometricElement.is2d())\r\n iterator = GeometryStreamIterator.fromGeometricElement2d(geometricElement);\r\n else\r\n iterator = GeometryStreamIterator.fromGeometricElement3d(geometricElement as GeometricElement3dProps);\r\n } else if (elem instanceof GeometryPart) {\r\n iterator = GeometryStreamIterator.fromGeometryPart(elem);\r\n }\r\n\r\n return undefined !== iterator ? { iterator, geometricElement } : undefined;\r\n }\r\n\r\n public summarizeRange3d(range: Range3d): string {\r\n return `SubGraphicRange: ${this.stringify(range)}`;\r\n }\r\n\r\n public summarizePrimitive(lines: string[], primitive: TextStringPrimitive | ImagePrimitive): void {\r\n const summary = primitive.type;\r\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\r\n lines.push(summary);\r\n return;\r\n }\r\n\r\n const json = this.stringify(primitive.type === \"textString\" ? primitive.textString : primitive.image);\r\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\r\n lines.push(`${summary}: ${json}`);\r\n return;\r\n }\r\n\r\n lines.push(`${summary}:`);\r\n lines.push(json);\r\n }\r\n\r\n public summarizeBRep(lines: string[], brep: BRepEntity.DataProps): void {\r\n const summary = \"brep\";\r\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\r\n lines.push(summary);\r\n return;\r\n }\r\n\r\n const json = this.stringify({ type: brep.type, transform: brep.transform, faceSymbology: brep.faceSymbology });\r\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\r\n lines.push(`${summary}: ${json}`);\r\n return;\r\n }\r\n\r\n lines.push(`${summary}:`);\r\n lines.push(json);\r\n }\r\n\r\n public summarizePartReference(partId: string, partToLocal?: Transform): string {\r\n let line = `part id: ${partId}`;\r\n if (undefined !== partToLocal)\r\n line = `${line} transform: ${this.stringify(partToLocal)}`;\r\n\r\n return line;\r\n }\r\n\r\n public summarizeGeometryQuery(lines: string[], query: AnyGeometryQuery): void {\r\n switch (this.verbosity) {\r\n case GeometrySummaryVerbosity.Detailed:\r\n lines.push(this.summarizeGeometryQueryDetailed(query));\r\n break;\r\n case GeometrySummaryVerbosity.Full:\r\n lines.push(this.summarizeGeometryQueryFull(query));\r\n break;\r\n default:\r\n lines.push(this.summarizeGeometryQueryBasic(query));\r\n break;\r\n }\r\n }\r\n\r\n public summarizeGeometryQueryBasic(query: AnyGeometryQuery): string {\r\n switch (query.geometryCategory) {\r\n case \"solid\":\r\n return query.solidPrimitiveType;\r\n case \"curvePrimitive\":\r\n return query.curvePrimitiveType;\r\n case \"curveCollection\":\r\n return query.curveCollectionType;\r\n default:\r\n return query.geometryCategory;\r\n }\r\n }\r\n\r\n public summarizeGeometryQueryFull(query: AnyGeometryQuery): string {\r\n return this.geometryQueryToJson(query);\r\n }\r\n\r\n public geometryQueryToJson(query: AnyGeometryQuery): string {\r\n try {\r\n const json = IModelJson.Writer.toIModelJson(query);\r\n const str = JSON.stringify(json);\r\n return this.wantSquish ? this.squish(str) : str;\r\n } catch (err) {\r\n return BentleyError.getErrorMessage(err);\r\n }\r\n }\r\n\r\n // Earlin likes to put tons of whitespace + newlines into his JSON. Remove it.\r\n public squish(str: string): string {\r\n return str.replace(/\\s+/g, \"\");\r\n }\r\n\r\n public stringify(obj: object): string {\r\n const json = JSON.stringify(obj);\r\n return this.wantSquish ? this.squish(json) : json;\r\n }\r\n\r\n public summarizeGeometryQueryDetailed(query: AnyGeometryQuery): string {\r\n let summary = `${this.summarizeGeometryQueryBasic(query)}: `;\r\n switch (query.geometryCategory) {\r\n case \"solid\":\r\n return summary + this.summarizeSolidPrimitive(query);\r\n case \"curvePrimitive\":\r\n return summary + this.summarizeCurvePrimitive(query);\r\n case \"curveCollection\":\r\n return summary + this.summarizeCurveCollection(query);\r\n case \"pointCollection\":\r\n return `${summary} numPoints: ${query.points.length}`;\r\n case \"bsurf\":\r\n return `${summary}'\r\n ' poleDimension: ${query.poleDimension}'\r\n ' numPolesTotal: ${query.numPolesTotal()}'\r\n ' degree[U,V]: ${JSON.stringify([query.degreeUV(UVSelect.uDirection), query.degreeUV(UVSelect.VDirection)])}'\r\n ' order[U,V]: ${JSON.stringify([query.orderUV(UVSelect.uDirection), query.orderUV(UVSelect.VDirection)])}'\r\n ' numSpan[U,V]: ${JSON.stringify([query.numSpanUV(UVSelect.uDirection), query.numSpanUV(UVSelect.VDirection)])}'\r\n ' numPoles[U,V]: ${JSON.stringify([query.numPolesUV(UVSelect.uDirection), query.numPolesUV(UVSelect.VDirection)])}'\r\n ' poleStep[U,V]: ${JSON.stringify([query.poleStepUV(UVSelect.uDirection), query.poleStepUV(UVSelect.VDirection)])}`;\r\n case \"polyface\": {\r\n const data = query.data;\r\n summary = `${summary} pointCount: ${data.point.length}'\r\n ' pointIndexCount: ${data.pointIndex.length}`;\r\n if (query.twoSided)\r\n summary = `${summary} (two-sided)`;\r\n if (undefined !== data.normal)\r\n summary = `${summary} normalCount: ${data.normal.length}`;\r\n if (undefined !== data.param)\r\n summary = `${summary} paramCount: ${data.param.length}`;\r\n if (undefined !== data.color)\r\n summary = `${summary} colorCount: ${data.color.length}`;\r\n\r\n return summary;\r\n }\r\n case \"point\":\r\n return summary + this.geometryQueryToJson(query);\r\n }\r\n }\r\n\r\n public summarizeSolidPrimitive(solid: SolidPrimitive): string {\r\n const summary: string = solid.capped ? \" capped\" : \" uncapped\";\r\n switch (solid.solidPrimitiveType) {\r\n case \"box\":\r\n const box: Box = (solid as Box);\r\n return `${summary}'\r\n ' baseOrigin: ${JSON.stringify(box.getBaseOrigin().toJSON())}'\r\n ' topOrigin: ${JSON.stringify(box.getTopOrigin().toJSON())}'\r\n ' baseX: ${box.getBaseX()}'\r\n ' baseY: ${box.getBaseY()}`;\r\n case \"cone\":\r\n const cone: Cone = solid as Cone;\r\n return `${summary}'\r\n ' baseCenterPoint: ${JSON.stringify(cone.getCenterA())}'\r\n ' topCenterPoint: ${JSON.stringify(cone.getCenterB())}'\r\n ' baseCenterRadius: ${JSON.stringify(cone.getRadiusA())}'\r\n ' topCenterRadius: ${JSON.stringify(cone.getRadiusB())}`;\r\n case \"sphere\":\r\n const sphere: Sphere = solid as Sphere;\r\n return `${summary}'\r\n ' centerPoint: ${JSON.stringify(sphere.cloneCenter().toJSON())}'\r\n ' radius: ${JSON.stringify(sphere.trueSphereRadius())}`;\r\n case \"linearSweep\":\r\n const linearSweep: LinearSweep = solid as LinearSweep;\r\n return `${summary}'\r\n ' vector: ${linearSweep.cloneSweepVector().toJSON()}'\r\n ' curves${this.summarizeCurveCollection(linearSweep.getCurvesRef())}`;\r\n case \"rotationalSweep\":\r\n const rotationalSweep: RotationalSweep = solid as RotationalSweep;\r\n const axis = rotationalSweep.cloneAxisRay();\r\n return `${summary}'\r\n ' center: ${axis.origin.toJSON()}'\r\n ' axis: ${JSON.stringify(axis.direction.toJSON())}'\r\n ' sweepAngle: ${rotationalSweep.getSweep().degrees}`;\r\n case \"ruledSweep\":\r\n const ruledSweep: RuledSweep = solid as RuledSweep;\r\n const summarizedCollection = ruledSweep.cloneContours().map((curveCollection) => this.summarizeCurveCollection(curveCollection));\r\n return `${summary}'\r\n ' isClosedVolume${ruledSweep.isClosedVolume}'\r\n ' contours: ${JSON.stringify(summarizedCollection)}`;\r\n case \"torusPipe\":\r\n const torusPipe: TorusPipe = solid as TorusPipe;\r\n const vectorX = torusPipe.cloneVectorX();\r\n const vectorY = torusPipe.cloneVectorY();\r\n const sweep = torusPipe.getSweepAngle();\r\n if (torusPipe.getIsReversed()) {\r\n vectorY.scaleInPlace(-1.0);\r\n sweep.setRadians(-sweep.radians);\r\n }\r\n return `${summary}'\r\n ' center: ${torusPipe.cloneCenter().toJSON()}'\r\n ' xyVectors: ${JSON.stringify([vectorX.toJSON(), vectorY.toJSON()])}'\r\n ' majorRadius: ${torusPipe.getMajorRadius()}'\r\n ' minorRadius: ${torusPipe.getMinorRadius()}'\r\n ' sweepAngle: ${sweep.degrees}`;\r\n }\r\n }\r\n\r\n public summarizeCurvePrimitive(curve: CurvePrimitive): string {\r\n let summary: string = \"\";\r\n const writer = new IModelJson.Writer();\r\n switch (curve.curvePrimitiveType) {\r\n case \"arc\":\r\n const arc: Arc3d = curve as Arc3d;\r\n summary = `${summary} center: ${JSON.stringify(arc.center.toJSON())}`;\r\n if (undefined !== arc.circularRadius)\r\n summary = `${summary} radius: ${arc.circularRadius()}`;\r\n summary = `${summary}'\r\n ' vectorX:${arc.vector0.toJSON()}'\r\n ' vectorY:${arc.vector90.toJSON()}'\r\n ' sweepStartEnd [${arc.sweep.startDegrees}, ${arc.sweep.endDegrees}]`\r\n + ` curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"lineSegment\":\r\n const lineSegment: LineSegment3d = curve as LineSegment3d;\r\n summary = `${summary} points: ${JSON.stringify(lineSegment.toJSON())}`;\r\n summary = `${summary} curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"lineString\":\r\n const lineString: LineString3d = curve as LineString3d;\r\n summary = `${summary} pointCount: ${lineString.numPoints()}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"bsplineCurve\":\r\n const bsplineCurve: BSplineCurve3d = curve as BSplineCurve3d;\r\n summary = `${summary}'\r\n ' curveOrder: ${bsplineCurve.order}'\r\n ' controlPointsCount: ${bsplineCurve.numPoles}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"interpolationCurve\":\r\n const interpolationCurve: InterpolationCurve3d = curve as InterpolationCurve3d;\r\n const interpolationProps = interpolationCurve.cloneProps();\r\n summary = `${summary}'\r\n ' curveOrder: ${interpolationProps.order}'\r\n ' controlPointsCount: ${interpolationProps.fitPoints.length}`;\r\n return summary;\r\n case \"akimaCurve\":\r\n const akimaCurve: AkimaCurve3d = curve as AkimaCurve3d;\r\n const akimaProps = akimaCurve.cloneProps();\r\n summary = `${summary}'\r\n ' controlPointsCount: ${akimaProps.fitPoints.length}`;\r\n return summary;\r\n case \"bezierCurve\":\r\n const bezierCurve: BezierCurveBase = curve as BezierCurveBase;\r\n summary = `${summary}'\r\n ' curveOrder: ${bezierCurve.order}'\r\n ' controlPointsCount: ${bezierCurve.numPoles}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"transitionSpiral\":\r\n const transitionSpiral: TransitionSpiral3d = curve as TransitionSpiral3d;\r\n const json = writer.handleTransitionSpiral(transitionSpiral);\r\n summary = summary + JSON.stringify(json);\r\n return summary;\r\n case \"curveChainWithDistanceIndex\":\r\n const curveChainWithDistanceIndex: CurveChainWithDistanceIndex = curve as CurveChainWithDistanceIndex;\r\n const path = curveChainWithDistanceIndex.path;\r\n summary = `${summary}'\r\n ' curveLength: ${curve.curveLength()}'\r\n ' isOpen: ${path.isOpenPath}`;\r\n return summary;\r\n }\r\n }\r\n\r\n public summarizeCurveCollection(curves: CurveCollection): string {\r\n let summary: string = \"\";\r\n switch (curves.curveCollectionType) {\r\n case \"loop\":\r\n const loop: Loop = curves as Loop;\r\n summary = `${summary} isInner: ${loop.isInner}`;\r\n break;\r\n case \"path\":\r\n const path: Path = curves as Path;\r\n summary = `${summary} isOpen: ${path.isOpenPath}`;\r\n break;\r\n }\r\n\r\n return `${summary}'\r\n ' numCurves: ${curves.collectCurvePrimitives().length}'\r\n ' boundary: ${curves.dgnBoundaryType()}`;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function generateGeometrySummaries(request: GeometrySummaryRequestProps, iModel: IModelDb): string {\r\n const generator = new ResponseGenerator(request, iModel);\r\n return generator.generateSummaries();\r\n}\r\n"]}
1
+ {"version":3,"file":"GeometrySummary.js","sourceRoot":"","sources":["../../src/GeometrySummary.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,sDAAgG;AAChG,wD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;mBACF,MAAM,CAAC,sBAAsB,EAAE,CAAC,MAAM;kBACvC,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC;IAC3C,CAAC;CACF;AAED,gBAAgB;AAChB,SAAgB,yBAAyB,CAAC,OAAoC,EAAE,MAAgB;IAC9F,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,iBAAiB,EAAE,CAAC;AACvC,CAAC;AAHD,8DAGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { assert, BentleyError, Id64Array, Id64String, IModelStatus } from \"@itwin/core-bentley\";\r\nimport {\r\n AkimaCurve3d, AnyGeometryQuery, Arc3d, BezierCurveBase, Box, BSplineCurve3d, Cone, CurveChainWithDistanceIndex, CurveCollection, CurvePrimitive, IModelJson,\r\n InterpolationCurve3d,\r\n LinearSweep, LineSegment3d, LineString3d, Loop, Path, Range3d, RotationalSweep, RuledSweep, SolidPrimitive, Sphere, TorusPipe, Transform,\r\n TransitionSpiral3d, UVSelect,\r\n} from \"@itwin/core-geometry\";\r\nimport {\r\n BRepEntity, GeometryParams, GeometryStreamIterator, GeometrySummaryRequestProps, GeometrySummaryVerbosity, ImagePrimitive,\r\n IModelError, TextStringPrimitive,\r\n} from \"@itwin/core-common\";\r\nimport { Element, GeometricElement, GeometryPart } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\n\r\ninterface ElementGeom {\r\n iterator: GeometryStreamIterator;\r\n geometricElement?: GeometricElement;\r\n}\r\n\r\n// cspell:ignore earlin\r\n\r\n/** Generates an array of GeometryStreamResponseProps. */\r\nclass ResponseGenerator {\r\n public verbosity = GeometrySummaryVerbosity.Basic;\r\n public includePlacement = false;\r\n public includePartReferences?: \"2d\" | \"3d\";\r\n public verboseSymbology = false;\r\n public elementIds: Id64Array;\r\n public iModel: IModelDb;\r\n\r\n public get wantSquish() { return GeometrySummaryVerbosity.Full !== this.verbosity; }\r\n\r\n public constructor(request: GeometrySummaryRequestProps, iModel: IModelDb) {\r\n this.elementIds = request.elementIds;\r\n this.iModel = iModel;\r\n const opts = request.options;\r\n if (undefined !== opts) {\r\n this.verbosity = undefined !== opts.geometryVerbosity ? opts.geometryVerbosity : GeometrySummaryVerbosity.Basic;\r\n this.includePlacement = true === opts.includePlacement;\r\n this.includePartReferences = opts.includePartReferences;\r\n this.verboseSymbology = true === opts.verboseSymbology;\r\n }\r\n }\r\n\r\n public generateSummaries(): string {\r\n const summaries: string[] = [];\r\n for (const elementId of this.elementIds)\r\n summaries.push(this.generateSummary(elementId));\r\n\r\n return summaries.join(\"\\n\");\r\n }\r\n\r\n public generateSummary(id: Id64String): string {\r\n let lines = [`[Geometry Summary for Element ${id}]`];\r\n try {\r\n const geom = this.getElementGeom(id);\r\n if (undefined === geom)\r\n throw new IModelError(IModelStatus.NoGeometry, \"Element is neither a geometric element nor a geometry part\");\r\n\r\n if (undefined !== geom.geometricElement)\r\n lines.push(this.summarizeElement(geom.geometricElement));\r\n else if (undefined !== this.includePartReferences)\r\n lines.push(this.summarizePartReferences(id, \"2d\" === this.includePartReferences)); // NB: Hideously inefficient if more than one element's summary was requested.\r\n\r\n let curGeomParams: GeometryParams | undefined;\r\n let curLocalRange: Range3d | undefined;\r\n for (const entry of geom.iterator) {\r\n if (this.verboseSymbology && (undefined === curGeomParams || !curGeomParams.isEquivalent(entry.geomParams))) {\r\n lines.push(`Symbology: ${this.stringify(entry.geomParams)}`);\r\n curGeomParams = entry.geomParams.clone();\r\n }\r\n\r\n if (undefined !== entry.localRange && (undefined === curLocalRange || !curLocalRange.isAlmostEqual(entry.localRange))) {\r\n lines.push(this.summarizeRange3d(entry.localRange));\r\n curLocalRange = entry.localRange;\r\n }\r\n\r\n const prim = entry.primitive;\r\n switch (prim.type) {\r\n case \"textString\":\r\n case \"image\":\r\n this.summarizePrimitive(lines, prim);\r\n break;\r\n case \"brep\":\r\n this.summarizeBRep(lines, prim.brep);\r\n break;\r\n case \"geometryQuery\":\r\n this.summarizeGeometryQuery(lines, prim.geometry);\r\n break;\r\n case \"partReference\":\r\n lines.push(this.summarizePartReference(prim.part.id, prim.part.toLocal));\r\n break;\r\n }\r\n }\r\n } catch (err) {\r\n lines = lines.slice(0, 1);\r\n lines.push(`ERROR: ${BentleyError.getErrorMessage(err)}`);\r\n }\r\n\r\n return lines.filter((line) => line !== \"\").join(\"\\n\");\r\n }\r\n\r\n public summarizeElement(elem: GeometricElement): string {\r\n const lines: string[] = [];\r\n lines.push(`(${elem.is2d() ? \"2D\" : \"3D\"}) Category: ${elem.category}`);\r\n lines.push(`Model: ${elem.model}`);\r\n if (this.includePlacement) {\r\n lines.push(`Range: ${this.stringify(elem.calculateRange3d())}`);\r\n lines.push(`Transform: ${this.stringify(elem.getPlacementTransform())}`);\r\n }\r\n\r\n return lines.join(\"\\n\");\r\n }\r\n\r\n public summarizePartReferences(id: Id64String, is2d: boolean): string {\r\n const refIds = this.iModel.nativeDb.findGeometryPartReferences([id], is2d);\r\n return `Part references (${refIds.length}): ${refIds.join()}`;\r\n }\r\n\r\n public getElementGeom(id: Id64String): ElementGeom | undefined {\r\n const elem = this.iModel.elements.getElement<Element>({ id, wantGeometry: true });\r\n let iterator: GeometryStreamIterator | undefined;\r\n let geometricElement: GeometricElement | undefined;\r\n if (elem instanceof GeometricElement) {\r\n geometricElement = elem;\r\n if (geometricElement.is2d()) {\r\n iterator = GeometryStreamIterator.fromGeometricElement2d(geometricElement);\r\n } else {\r\n assert(geometricElement.is3d());\r\n iterator = GeometryStreamIterator.fromGeometricElement3d(geometricElement);\r\n }\r\n } else if (elem instanceof GeometryPart) {\r\n iterator = GeometryStreamIterator.fromGeometryPart(elem);\r\n }\r\n\r\n return undefined !== iterator ? { iterator, geometricElement } : undefined;\r\n }\r\n\r\n public summarizeRange3d(range: Range3d): string {\r\n return `SubGraphicRange: ${this.stringify(range)}`;\r\n }\r\n\r\n public summarizePrimitive(lines: string[], primitive: TextStringPrimitive | ImagePrimitive): void {\r\n const summary = primitive.type;\r\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\r\n lines.push(summary);\r\n return;\r\n }\r\n\r\n const json = this.stringify(primitive.type === \"textString\" ? primitive.textString : primitive.image);\r\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\r\n lines.push(`${summary}: ${json}`);\r\n return;\r\n }\r\n\r\n lines.push(`${summary}:`);\r\n lines.push(json);\r\n }\r\n\r\n public summarizeBRep(lines: string[], brep: BRepEntity.DataProps): void {\r\n const summary = \"brep\";\r\n if (GeometrySummaryVerbosity.Basic >= this.verbosity) {\r\n lines.push(summary);\r\n return;\r\n }\r\n\r\n const json = this.stringify({ type: brep.type, transform: brep.transform, faceSymbology: brep.faceSymbology });\r\n if (GeometrySummaryVerbosity.Detailed >= this.verbosity) {\r\n lines.push(`${summary}: ${json}`);\r\n return;\r\n }\r\n\r\n lines.push(`${summary}:`);\r\n lines.push(json);\r\n }\r\n\r\n public summarizePartReference(partId: string, partToLocal?: Transform): string {\r\n let line = `part id: ${partId}`;\r\n if (undefined !== partToLocal)\r\n line = `${line} transform: ${this.stringify(partToLocal)}`;\r\n\r\n return line;\r\n }\r\n\r\n public summarizeGeometryQuery(lines: string[], query: AnyGeometryQuery): void {\r\n switch (this.verbosity) {\r\n case GeometrySummaryVerbosity.Detailed:\r\n lines.push(this.summarizeGeometryQueryDetailed(query));\r\n break;\r\n case GeometrySummaryVerbosity.Full:\r\n lines.push(this.summarizeGeometryQueryFull(query));\r\n break;\r\n default:\r\n lines.push(this.summarizeGeometryQueryBasic(query));\r\n break;\r\n }\r\n }\r\n\r\n public summarizeGeometryQueryBasic(query: AnyGeometryQuery): string {\r\n switch (query.geometryCategory) {\r\n case \"solid\":\r\n return query.solidPrimitiveType;\r\n case \"curvePrimitive\":\r\n return query.curvePrimitiveType;\r\n case \"curveCollection\":\r\n return query.curveCollectionType;\r\n default:\r\n return query.geometryCategory;\r\n }\r\n }\r\n\r\n public summarizeGeometryQueryFull(query: AnyGeometryQuery): string {\r\n return this.geometryQueryToJson(query);\r\n }\r\n\r\n public geometryQueryToJson(query: AnyGeometryQuery): string {\r\n try {\r\n const json = IModelJson.Writer.toIModelJson(query);\r\n const str = JSON.stringify(json);\r\n return this.wantSquish ? this.squish(str) : str;\r\n } catch (err) {\r\n return BentleyError.getErrorMessage(err);\r\n }\r\n }\r\n\r\n // Earlin likes to put tons of whitespace + newlines into his JSON. Remove it.\r\n public squish(str: string): string {\r\n return str.replace(/\\s+/g, \"\");\r\n }\r\n\r\n public stringify(obj: object): string {\r\n const json = JSON.stringify(obj);\r\n return this.wantSquish ? this.squish(json) : json;\r\n }\r\n\r\n public summarizeGeometryQueryDetailed(query: AnyGeometryQuery): string {\r\n let summary = `${this.summarizeGeometryQueryBasic(query)}: `;\r\n switch (query.geometryCategory) {\r\n case \"solid\":\r\n return summary + this.summarizeSolidPrimitive(query);\r\n case \"curvePrimitive\":\r\n return summary + this.summarizeCurvePrimitive(query);\r\n case \"curveCollection\":\r\n return summary + this.summarizeCurveCollection(query);\r\n case \"pointCollection\":\r\n return `${summary} numPoints: ${query.points.length}`;\r\n case \"bsurf\":\r\n return `${summary}'\r\n ' poleDimension: ${query.poleDimension}'\r\n ' numPolesTotal: ${query.numPolesTotal()}'\r\n ' degree[U,V]: ${JSON.stringify([query.degreeUV(UVSelect.uDirection), query.degreeUV(UVSelect.VDirection)])}'\r\n ' order[U,V]: ${JSON.stringify([query.orderUV(UVSelect.uDirection), query.orderUV(UVSelect.VDirection)])}'\r\n ' numSpan[U,V]: ${JSON.stringify([query.numSpanUV(UVSelect.uDirection), query.numSpanUV(UVSelect.VDirection)])}'\r\n ' numPoles[U,V]: ${JSON.stringify([query.numPolesUV(UVSelect.uDirection), query.numPolesUV(UVSelect.VDirection)])}'\r\n ' poleStep[U,V]: ${JSON.stringify([query.poleStepUV(UVSelect.uDirection), query.poleStepUV(UVSelect.VDirection)])}`;\r\n case \"polyface\": {\r\n const data = query.data;\r\n summary = `${summary} pointCount: ${data.point.length}'\r\n ' pointIndexCount: ${data.pointIndex.length}`;\r\n if (query.twoSided)\r\n summary = `${summary} (two-sided)`;\r\n if (undefined !== data.normal)\r\n summary = `${summary} normalCount: ${data.normal.length}`;\r\n if (undefined !== data.param)\r\n summary = `${summary} paramCount: ${data.param.length}`;\r\n if (undefined !== data.color)\r\n summary = `${summary} colorCount: ${data.color.length}`;\r\n\r\n return summary;\r\n }\r\n case \"point\":\r\n return summary + this.geometryQueryToJson(query);\r\n }\r\n }\r\n\r\n public summarizeSolidPrimitive(solid: SolidPrimitive): string {\r\n const summary: string = solid.capped ? \" capped\" : \" uncapped\";\r\n switch (solid.solidPrimitiveType) {\r\n case \"box\":\r\n const box: Box = (solid as Box);\r\n return `${summary}'\r\n ' baseOrigin: ${JSON.stringify(box.getBaseOrigin().toJSON())}'\r\n ' topOrigin: ${JSON.stringify(box.getTopOrigin().toJSON())}'\r\n ' baseX: ${box.getBaseX()}'\r\n ' baseY: ${box.getBaseY()}`;\r\n case \"cone\":\r\n const cone: Cone = solid as Cone;\r\n return `${summary}'\r\n ' baseCenterPoint: ${JSON.stringify(cone.getCenterA())}'\r\n ' topCenterPoint: ${JSON.stringify(cone.getCenterB())}'\r\n ' baseCenterRadius: ${JSON.stringify(cone.getRadiusA())}'\r\n ' topCenterRadius: ${JSON.stringify(cone.getRadiusB())}`;\r\n case \"sphere\":\r\n const sphere: Sphere = solid as Sphere;\r\n return `${summary}'\r\n ' centerPoint: ${JSON.stringify(sphere.cloneCenter().toJSON())}'\r\n ' radius: ${JSON.stringify(sphere.trueSphereRadius())}`;\r\n case \"linearSweep\":\r\n const linearSweep: LinearSweep = solid as LinearSweep;\r\n return `${summary}'\r\n ' vector: ${linearSweep.cloneSweepVector().toJSON()}'\r\n ' curves${this.summarizeCurveCollection(linearSweep.getCurvesRef())}`;\r\n case \"rotationalSweep\":\r\n const rotationalSweep: RotationalSweep = solid as RotationalSweep;\r\n const axis = rotationalSweep.cloneAxisRay();\r\n return `${summary}'\r\n ' center: ${axis.origin.toJSON()}'\r\n ' axis: ${JSON.stringify(axis.direction.toJSON())}'\r\n ' sweepAngle: ${rotationalSweep.getSweep().degrees}`;\r\n case \"ruledSweep\":\r\n const ruledSweep: RuledSweep = solid as RuledSweep;\r\n const summarizedCollection = ruledSweep.cloneContours().map((curveCollection) => this.summarizeCurveCollection(curveCollection));\r\n return `${summary}'\r\n ' isClosedVolume${ruledSweep.isClosedVolume}'\r\n ' contours: ${JSON.stringify(summarizedCollection)}`;\r\n case \"torusPipe\":\r\n const torusPipe: TorusPipe = solid as TorusPipe;\r\n const vectorX = torusPipe.cloneVectorX();\r\n const vectorY = torusPipe.cloneVectorY();\r\n const sweep = torusPipe.getSweepAngle();\r\n if (torusPipe.getIsReversed()) {\r\n vectorY.scaleInPlace(-1.0);\r\n sweep.setRadians(-sweep.radians);\r\n }\r\n return `${summary}'\r\n ' center: ${torusPipe.cloneCenter().toJSON()}'\r\n ' xyVectors: ${JSON.stringify([vectorX.toJSON(), vectorY.toJSON()])}'\r\n ' majorRadius: ${torusPipe.getMajorRadius()}'\r\n ' minorRadius: ${torusPipe.getMinorRadius()}'\r\n ' sweepAngle: ${sweep.degrees}`;\r\n }\r\n }\r\n\r\n public summarizeCurvePrimitive(curve: CurvePrimitive): string {\r\n let summary: string = \"\";\r\n const writer = new IModelJson.Writer();\r\n switch (curve.curvePrimitiveType) {\r\n case \"arc\":\r\n const arc: Arc3d = curve as Arc3d;\r\n summary = `${summary} center: ${JSON.stringify(arc.center.toJSON())}`;\r\n if (undefined !== arc.circularRadius)\r\n summary = `${summary} radius: ${arc.circularRadius()}`;\r\n summary = `${summary}'\r\n ' vectorX:${arc.vector0.toJSON()}'\r\n ' vectorY:${arc.vector90.toJSON()}'\r\n ' sweepStartEnd [${arc.sweep.startDegrees}, ${arc.sweep.endDegrees}]`\r\n + ` curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"lineSegment\":\r\n const lineSegment: LineSegment3d = curve as LineSegment3d;\r\n summary = `${summary} points: ${JSON.stringify(lineSegment.toJSON())}`;\r\n summary = `${summary} curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"lineString\":\r\n const lineString: LineString3d = curve as LineString3d;\r\n summary = `${summary} pointCount: ${lineString.numPoints()}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"bsplineCurve\":\r\n const bsplineCurve: BSplineCurve3d = curve as BSplineCurve3d;\r\n summary = `${summary}'\r\n ' curveOrder: ${bsplineCurve.order}'\r\n ' controlPointsCount: ${bsplineCurve.numPoles}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"interpolationCurve\":\r\n const interpolationCurve: InterpolationCurve3d = curve as InterpolationCurve3d;\r\n const interpolationProps = interpolationCurve.cloneProps();\r\n summary = `${summary}'\r\n ' curveOrder: ${interpolationProps.order}'\r\n ' controlPointsCount: ${interpolationProps.fitPoints.length}`;\r\n return summary;\r\n case \"akimaCurve\":\r\n const akimaCurve: AkimaCurve3d = curve as AkimaCurve3d;\r\n const akimaProps = akimaCurve.cloneProps();\r\n summary = `${summary}'\r\n ' controlPointsCount: ${akimaProps.fitPoints.length}`;\r\n return summary;\r\n case \"bezierCurve\":\r\n const bezierCurve: BezierCurveBase = curve as BezierCurveBase;\r\n summary = `${summary}'\r\n ' curveOrder: ${bezierCurve.order}'\r\n ' controlPointsCount: ${bezierCurve.numPoles}'\r\n ' curveLength: ${curve.curveLength()}`;\r\n return summary;\r\n case \"transitionSpiral\":\r\n const transitionSpiral: TransitionSpiral3d = curve as TransitionSpiral3d;\r\n const json = writer.handleTransitionSpiral(transitionSpiral);\r\n summary = summary + JSON.stringify(json);\r\n return summary;\r\n case \"curveChainWithDistanceIndex\":\r\n const curveChainWithDistanceIndex: CurveChainWithDistanceIndex = curve as CurveChainWithDistanceIndex;\r\n const path = curveChainWithDistanceIndex.path;\r\n summary = `${summary}'\r\n ' curveLength: ${curve.curveLength()}'\r\n ' isOpen: ${path.isOpenPath}`;\r\n return summary;\r\n }\r\n }\r\n\r\n public summarizeCurveCollection(curves: CurveCollection): string {\r\n let summary: string = \"\";\r\n switch (curves.curveCollectionType) {\r\n case \"loop\":\r\n const loop: Loop = curves as Loop;\r\n summary = `${summary} isInner: ${loop.isInner}`;\r\n break;\r\n case \"path\":\r\n const path: Path = curves as Path;\r\n summary = `${summary} isOpen: ${path.isOpenPath}`;\r\n break;\r\n }\r\n\r\n return `${summary}'\r\n ' numCurves: ${curves.collectCurvePrimitives().length}'\r\n ' boundary: ${curves.dgnBoundaryType()}`;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function generateGeometrySummaries(request: GeometrySummaryRequestProps, iModel: IModelDb): string {\r\n const generator = new ResponseGenerator(request, iModel);\r\n return generator.generateSummaries();\r\n}\r\n"]}