@itwin/core-backend 5.0.0-dev.2 → 5.0.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BlobContainerService.d.ts +22 -1
- package/lib/cjs/BlobContainerService.d.ts.map +1 -1
- package/lib/cjs/BlobContainerService.js.map +1 -1
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.js +2 -2
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangedElementsManager.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +242 -242
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChannelControl.js.map +1 -1
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.js +5 -5
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/GeometrySummary.js +47 -47
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelDb.js +8 -8
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.js +1 -1
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/LockControl.js.map +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/SchemaSync.js.map +1 -1
- package/lib/cjs/SchemaUtils.js.map +1 -1
- package/lib/cjs/SheetIndex.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/TextAnnotationGeometry.js.map +1 -1
- package/lib/cjs/TextAnnotationLayout.js.map +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Base.Schema.json +32 -32
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +27 -27
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +94 -94
- package/lib/cjs/assets/Settings/backend.setting.json5 +21 -21
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/internal/ChangesetConflictArgs.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/NativePlatform.js.map +1 -1
- package/lib/cjs/internal/NoLocks.js.map +1 -1
- package/lib/cjs/internal/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/internal/Symbols.js.map +1 -1
- package/lib/cjs/internal/cross-package.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/SettingsSchemasImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceSqliteDb.js.map +1 -1
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/lib/cjs/workspace/WorkspaceEditor.js.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementAspect.js","sourceRoot":"","sources":["../../src/ElementAspect.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAA+I;AAC/I,qCAAkC;AAGlC,sDAA2D;AAC3D,gDAAoD;AA0BpD;;;;GAIG;AACH,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,SAAS,KAAa,OAAO,eAAe,CAAC,CAAC,CAAC;IAG1E,kFAAkF;IAClF,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;IAEe,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAwB,CAAC;QACjD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;OAIG;IACO,MAAM,CAAC,QAAQ,CAAC,GAAqB;QAC7C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAC9B,MAAM,CAAC,QAAQ,CAAC,wBAAc,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,CAA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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,oCAApB,oBAAoB,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, EntityReferenceSet, 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\nimport { _verifyChannel } from \"./internal/Symbols\";\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 /** The model for the aspect affected by this event */\r\n model: Id64String;\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 public static override get className(): string { return \"ElementAspect\"; }\r\n public element: RelatedElement;\r\n\r\n /** Construct an aspect from its JSON representation and its containing iModel. */\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 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 const { props, iModel } = arg;\r\n iModel.channels[_verifyChannel](arg.model);\r\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"insert aspect\");\r\n }\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 const { props, iModel } = arg;\r\n iModel.channels[_verifyChannel](arg.model);\r\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"update aspect\");\r\n }\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 const { aspectId, iModel } = arg;\r\n iModel.channels[_verifyChannel](arg.model);\r\n const { element } = iModel.elements.getAspect(aspectId);\r\n iModel.locks.checkExclusiveLock(element.id, \"element\", \"delete aspect\");\r\n }\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/** 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 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 public static override get className(): string { return \"ElementMultiAspect\"; }\r\n}\r\n\r\n/**\r\n * @public\r\n */\r\nexport class ChannelRootAspect extends ElementUniqueAspect {\r\n public static override get className(): string { return \"ChannelRootAspect\"; }\r\n /** Insert a ChannelRootAspect on the specified element.\r\n * @deprecated in 4.0 use [[ChannelControl.makeChannelRoot]]. This method does not enforce the rule that channels may not nest and is therefore dangerous.\r\n */\r\n public static insert(iModel: IModelDb, ownerId: Id64String, channelName: string) {\r\n const props: ChannelRootAspectProps = { classFullName: this.classFullName, element: { id: ownerId }, owner: channelName };\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 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 * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\r\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\r\n */\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 * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\r\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\r\n */\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 /** Construct an aspect from its JSON representation and its containing iModel. */\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 /** @deprecated in 3.x. findAllBySource */\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 /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\r\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\r\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\r\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\r\n * Therefore, the result array could have more than one entry with the same elementId.\r\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\r\n * @param iModelDb The iModel to query\r\n * @param scope The scope of the ExternalSourceAspects to find\r\n * @param kind The kind of the ExternalSourceAspects to find\r\n * @param identifier The identifier of the ExternalSourceAspects to find\r\n * @returns the query results\r\n */\r\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ 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 const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\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 while (DbResult.BE_SQLITE_ROW === statement.step()) {\r\n found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });\r\n }\r\n });\r\n return found;\r\n }\r\n\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 protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n if (this.scope)\r\n referenceIds.addElement(this.scope.id);\r\n referenceIds.addElement(this.element.id);\r\n if (this.source)\r\n referenceIds.addElement(this.source.id);\r\n }\r\n}\r\n\r\n/** @public */\r\nexport namespace ExternalSourceAspect {\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,oDAA+I;AAC/I,qCAAkC;AAGlC,sDAA2D;AAC3D,gDAAoD;AA0BpD;;;;GAIG;AACH,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,SAAS,KAAa,OAAO,eAAe,CAAC,CAAC,CAAC;IAG1E,kFAAkF;IAClF,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;IAEe,MAAM;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAwB,CAAC;QACjD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;OAIG;IACO,MAAM,CAAC,QAAQ,CAAC,GAAqB;QAC7C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAC9B,MAAM,CAAC,QAAQ,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GD,oDAsGC;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,oCAApB,oBAAoB,QAcpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementAspects\n */\n\nimport { ChannelRootAspectProps, ElementAspectProps, EntityReferenceSet, ExternalSourceAspectProps, RelatedElement } from \"@itwin/core-common\";\nimport { Entity } from \"./Entity\";\nimport { IModelDb } from \"./IModelDb\";\nimport { ECSqlStatement } from \"./ECSqlStatement\";\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\nimport { _verifyChannel } from \"./internal/Symbols\";\n\n/** Argument for the `ElementAspect.onXxx` static methods\n * @beta\n */\nexport interface OnAspectArg {\n /** The iModel for the aspect affected by this event. */\n iModel: IModelDb;\n /** The model for the aspect affected by this event */\n model: Id64String;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that supply the properties of an aspect to be inserted or updated.\n * @beta\n */\nexport interface OnAspectPropsArg extends OnAspectArg {\n /** The new properties of the aspect affected by this event. */\n props: Readonly<ElementAspectProps>;\n}\n/** Argument for the `ElementAspect.onXxx` static methods that only supply the Id of the affected aspect.\n * @beta\n */\nexport interface OnAspectIdArg extends OnAspectArg {\n /** The Id of the aspect affected by this event */\n aspectId: Id64String;\n}\n\n/** An Element Aspect is a class that defines a set of properties that are related to (and owned by) a single element.\n * Semantically, an ElementAspect can be considered part of the Element. Thus, an ElementAspect is deleted if its owning Element is deleted.\n * BIS Guideline: Subclass ElementUniqueAspect or ElementMultiAspect rather than subclassing ElementAspect directly.\n * @public\n */\nexport class ElementAspect extends Entity {\n public static override get className(): string { return \"ElementAspect\"; }\n public element: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ElementAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.element = RelatedElement.fromJSON(props.element)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n\n public override toJSON(): ElementAspectProps {\n const val = super.toJSON() as ElementAspectProps;\n val.element = this.element;\n return val;\n }\n\n /** Called before a new ElementAspect is inserted.\n * @note throw an exception to disallow the insert\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInsert(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"insert aspect\");\n }\n\n /** Called after a new ElementAspect was inserted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onInserted(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is updated.\n * @note throw an exception to disallow the update\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdate(arg: OnAspectPropsArg): void {\n const { props, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n iModel.locks.checkExclusiveLock(props.element.id, \"element\", \"update aspect\");\n }\n\n /** Called after an ElementAspect was updated.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onUpdated(_arg: OnAspectPropsArg): void { }\n\n /** Called before an ElementAspect is deleted.\n * @note throw an exception to disallow the delete\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDelete(arg: OnAspectIdArg): void {\n const { aspectId, iModel } = arg;\n iModel.channels[_verifyChannel](arg.model);\n const { element } = iModel.elements.getAspect(aspectId);\n iModel.locks.checkExclusiveLock(element.id, \"element\", \"delete aspect\");\n }\n\n /** Called after an ElementAspect was deleted.\n * @note If you override this method, you must call super.\n * @beta\n */\n protected static onDeleted(_arg: OnAspectIdArg): void { }\n}\n/** An Element Unique Aspect is an ElementAspect where there can be only zero or one instance of the Element Aspect class per Element.\n * @public\n */\nexport class ElementUniqueAspect extends ElementAspect {\n public static override get className(): string { return \"ElementUniqueAspect\"; }\n}\n\n/** An Element Multi-Aspect is an ElementAspect where there can be **n** instances of the Element Aspect class per Element.\n * @public\n */\nexport class ElementMultiAspect extends ElementAspect {\n public static override get className(): string { return \"ElementMultiAspect\"; }\n}\n\n/**\n * @public\n */\nexport class ChannelRootAspect extends ElementUniqueAspect {\n public static override get className(): string { return \"ChannelRootAspect\"; }\n /** Insert a ChannelRootAspect on the specified element.\n * @deprecated in 4.0 use [[ChannelControl.makeChannelRoot]]. This method does not enforce the rule that channels may not nest and is therefore dangerous.\n */\n public static insert(iModel: IModelDb, ownerId: Id64String, channelName: string) {\n const props: ChannelRootAspectProps = { classFullName: this.classFullName, element: { id: ownerId }, owner: channelName };\n iModel.elements.insertAspect(props);\n }\n}\n\n/** An ElementMultiAspect that stores synchronization information for an Element originating from an external source.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.2\n * @public\n */\nexport class ExternalSourceAspect extends ElementMultiAspect {\n public static override get className(): string { return \"ExternalSourceAspect\"; }\n\n /** An element that scopes the combination of `kind` and `identifier` to uniquely identify the object from the external source.\n * @note Warning: in a future major release the `scope` property will be optional, since the scope is intended to be potentially invalid.\n * all references should treat it as potentially undefined, but we cannot change the type yet since that is a breaking change.\n */\n public scope: RelatedElement;\n /** The identifier of the object in the source repository. */\n public identifier: string;\n /** The kind of object within the source repository. */\n public kind: string;\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. */\n public checksum?: string;\n /** An optional value that is typically a version number or a pseudo version number like last modified time.\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.\n * If present, this value must be guaranteed to change when any of the source object's content changes.\n */\n public version?: string;\n /** A place where additional JSON properties can be stored. For example, provenance information or properties relating to the synchronization process.\n * @note Warning: in a future major release, the type of `jsonProperties` will be changed to object, and itwin.js will automatically stringify it when writing to the iModel.\n * This will be a breaking change, since application code will have to change from supplying a string to supplying an object.\n */\n public jsonProperties?: string;\n /** The source of the imported/synchronized object. Should point to an instance of [ExternalSource]($backend). */\n public source?: RelatedElement;\n\n /** Construct an aspect from its JSON representation and its containing iModel. */\n constructor(props: ExternalSourceAspectProps, iModel: IModelDb) {\n super(props, iModel);\n this.scope = RelatedElement.fromJSON(props.scope)!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n this.source = RelatedElement.fromJSON(props.source);\n this.identifier = props.identifier;\n this.kind = props.kind;\n this.checksum = props.checksum;\n this.version = props.version;\n this.jsonProperties = props.jsonProperties;\n }\n\n /** @deprecated in 3.x. findAllBySource */\n public static findBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): { elementId?: Id64String, aspectId?: Id64String } {\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\n let elementId: Id64String | undefined;\n let aspectId: Id64String | undefined;\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\n statement.bindId(\"scope\", scope);\n statement.bindString(\"kind\", kind);\n statement.bindString(\"identifier\", identifier);\n if (DbResult.BE_SQLITE_ROW === statement.step()) {\n elementId = statement.getValue(0).getId();\n aspectId = statement.getValue(1).getId();\n }\n });\n return { elementId, aspectId };\n }\n\n /** Look up the elements that contain one or more ExternalSourceAspect with the specified Scope, Kind, and Identifier.\n * The result of this function is an array of all of the ExternalSourceAspects that were found, each associated with the owning element.\n * A given element could have more than one ExternalSourceAspect with the given scope, kind, and identifier.\n * Also, many elements could have ExternalSourceAspect with the same scope, kind, and identifier.\n * Therefore, the result array could have more than one entry with the same elementId.\n * Aspects are never shared. Each aspect has its own unique ECInstanceId.\n * @param iModelDb The iModel to query\n * @param scope The scope of the ExternalSourceAspects to find\n * @param kind The kind of the ExternalSourceAspects to find\n * @param identifier The identifier of the ExternalSourceAspects to find\n * @returns the query results\n */\n public static findAllBySource(iModelDb: IModelDb, scope: Id64String, kind: string, identifier: string): Array<{ elementId: Id64String, aspectId: Id64String }> {\n const sql = `SELECT Element.Id, ECInstanceId FROM ${ExternalSourceAspect.classFullName} WHERE (Scope.Id=:scope AND Kind=:kind AND Identifier=:identifier)`;\n const found: Array<{ elementId: Id64String, aspectId: Id64String }> = [];\n iModelDb.withPreparedStatement(sql, (statement: ECSqlStatement) => {\n statement.bindId(\"scope\", scope);\n statement.bindString(\"kind\", kind);\n statement.bindString(\"identifier\", identifier);\n while (DbResult.BE_SQLITE_ROW === statement.step()) {\n found.push({ elementId: statement.getValue(0).getId(), aspectId: statement.getValue(1).getId() });\n }\n });\n return found;\n }\n\n public override toJSON(): ExternalSourceAspectProps {\n const val = super.toJSON() as ExternalSourceAspectProps;\n val.scope = this.scope;\n val.source = this.source;\n val.identifier = this.identifier;\n val.kind = this.kind;\n val.checksum = this.checksum;\n val.version = this.version;\n val.jsonProperties = this.jsonProperties;\n return val;\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.scope)\n referenceIds.addElement(this.scope.id);\n referenceIds.addElement(this.element.id);\n if (this.source)\n referenceIds.addElement(this.source.id);\n }\n}\n\n/** @public */\nexport namespace ExternalSourceAspect {\n /** Standard values for the `Kind` property of `ExternalSourceAspect`.\n * @public\n */\n export enum Kind {\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Element]] provenance */\n Element = \"Element\",\n /** Indicates that the [[ExternalSourceAspect]] is storing [[Relationship]] provenance */\n Relationship = \"Relationship\",\n /** Indicates that the [[ExternalSourceAspect]] is storing *scope* provenance\n * @see [[ExternalSourceAspect.scope]]\n */\n Scope = \"Scope\",\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementGraphics.js","sourceRoot":"","sources":["../../src/ElementGraphics.ts"],"names":[],"mappings":";;AAaA,0DA0BC;AAvCD;;;+FAG+F;AAC/F,sDAA2D;AAC3D,oDAA8E;AAG9E,gDAA+C;AAE/C;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAAC,OAAoC,EAAE,MAAgB;IAClG,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,mBAAS,CAAC,CAAC,uBAAuB,CAAC,OAAc,CAAC,CAAC,CAAC,2CAA2C;IAE3H,IAAI,KAAyB,CAAC;IAC9B,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,8CAAsC;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;IACV,CAAC;IAED,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"ElementGraphics.js","sourceRoot":"","sources":["../../src/ElementGraphics.ts"],"names":[],"mappings":";;AAaA,0DA0BC;AAvCD;;;+FAG+F;AAC/F,sDAA2D;AAC3D,oDAA8E;AAG9E,gDAA+C;AAE/C;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAAC,OAAoC,EAAE,MAAgB;IAClG,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,mBAAS,CAAC,CAAC,uBAAuB,CAAC,OAAc,CAAC,CAAC,CAAC,2CAA2C;IAE3H,IAAI,KAAyB,CAAC;IAC9B,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,8CAAsC;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;IACV,CAAC;IAED,IAAA,qBAAM,EAAC,SAAS,KAAK,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { assert, IModelStatus } from \"@itwin/core-bentley\";\nimport { ElementGraphicsRequestProps, IModelError } from \"@itwin/core-common\";\nimport { ElementGraphicsStatus } from \"@bentley/imodeljs-native\";\nimport { IModelDb } from \"./IModelDb\";\nimport { _nativeDb } from \"./internal/Symbols\";\n\n/** See [[IModelDb.generateElementGraphics]] and IModelTileRpcImpl.requestElementGraphics.\n * @internal\n */\nexport async function generateElementGraphics(request: ElementGraphicsRequestProps, iModel: IModelDb): Promise<Uint8Array | undefined> {\n const result = await iModel[_nativeDb].generateElementGraphics(request as any); // ###TODO update package versions in addon\n\n let error: string | undefined;\n switch (result.status) {\n case ElementGraphicsStatus.NoGeometry:\n case ElementGraphicsStatus.Canceled:\n return undefined;\n case ElementGraphicsStatus.Success:\n return result.content;\n case ElementGraphicsStatus.InvalidJson:\n error = \"Invalid JSON\";\n break;\n case ElementGraphicsStatus.UnknownMajorFormatVersion:\n error = \"Unknown major format version\";\n break;\n case ElementGraphicsStatus.ElementNotFound:\n error = `Element Id ${request.elementId} not found`;\n break;\n case ElementGraphicsStatus.DuplicateRequestId:\n error = `Duplicate request Id \"${request.id}\"`;\n break;\n }\n\n assert(undefined !== error);\n throw new IModelError(IModelStatus.BadRequest, error);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementTreeWalker.js","sourceRoot":"","sources":["../../src/ElementTreeWalker.ts"],"names":[],"mappings":";;;AA2dA,8CAqBC;AAWD,sDAIC;AA/fD;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAgG;AAChG,oDAA4C;AAC5C,mEAAgE;AAChE,uCAA0G;AAC1G,yCAAsC;AACtC,mCAAiD;AAEjD,MAAM,cAAc,GAAG,GAAG,6CAAqB,CAAC,QAAQ,oBAAoB,CAAC;AAK7E,SAAS,yBAAyB,CAAC,MAAgB,EAAE,GAAc;IACjE,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAc,EAAE,CAAC;IAC9B,KAAK,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAClD,IAAI,QAAQ,KAAK,SAAS,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAClD,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;YAEnB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QACvB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnB,OAAO,CAAC,GAAG,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,YAAY,CAAC,MAAgB,EAAE,OAAmB;IACzD,OAAO,MAAM,CAAC,qBAAqB,CAAC,wBAAwB,iBAAO,CAAC,aAAa,qBAAqB,EAAE,CAAC,IAAI,EAAE,EAA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;IACrB,IAAI,UAAsB,CAAC;IAC3B,IAAI,IAAI,YAAY,mBAAQ,EAAE,CAAC;QAC7B,IAAA,qBAAM,EAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC;QACjC,MAAM,GAAG,IAAI,CAAC;QACd,UAAU,GAAG,IAAI,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACrB,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAC7B,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;IAC7B,CAAC;IAED,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC;IAC3B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,GAAG,CAAC;QACF,MAAM,GAAG,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAC3C,GAAG,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACrC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAC9B,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,EAAE;AAC9F,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,MAAgB,EAAE,UAAsB,EAAE,MAAkC;IAChH,MAAM,GAAG,GAAG,IAAI,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,GAAG,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAC5C,GAAG,CAAC,4BAA4B,EAAE,CAAC;AACrC,CAAC","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 Elements\r\n */\r\nimport { assert, DbResult, Id64Array, Id64String, Logger, LogLevel } from \"@itwin/core-bentley\";\r\nimport { IModel } from \"@itwin/core-common\";\r\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\r\nimport { DefinitionContainer, DefinitionElement, DefinitionPartition, Element, Subject } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { DefinitionModel, Model } from \"./Model\";\r\n\r\nconst loggerCategory = `${BackendLoggerCategory.IModelDb}.ElementTreeWalker`;\r\n\r\n/** @beta */\r\nexport interface ElementTreeWalkerModelInfo { model: Model, isDefinitionModel: boolean }\r\n\r\nfunction sortChildrenBeforeParents(iModel: IModelDb, ids: Id64Array): Array<Id64Array> {\r\n const children: Id64Array = [];\r\n const parents: Id64Array = [];\r\n for (const eid of ids) {\r\n const parentId = iModel.elements.queryParent(eid);\r\n if (parentId !== undefined && ids.includes(parentId))\r\n children.push(eid);\r\n else\r\n parents.push(eid);\r\n }\r\n\r\n if (children.length === 0)\r\n return [parents];\r\n\r\n return [...sortChildrenBeforeParents(iModel, children), parents];\r\n}\r\n\r\nfunction isModelEmpty(iModel: IModelDb, modelId: Id64String): boolean {\r\n return iModel.withPreparedStatement(`select count(*) from ${Element.classFullName} where Model.Id = ?`, (stmt) => {\r\n stmt.bindId(1, modelId);\r\n stmt.step();\r\n return stmt.getValue(0).getInteger() === 0;\r\n });\r\n}\r\n\r\nfunction isDefinitionModel(model: Model): boolean {\r\n return (model.id !== IModel.repositoryModelId) && (model instanceof DefinitionModel);\r\n}\r\n\r\nenum ElementPruningClassification { PRUNING_CLASS_Normal = 0, PRUNING_CLASS_Subject = 1, PRUNING_CLASS_Definition = 2, PRUNING_CLASS_DefinitionPartition = 3, }\r\n\r\nfunction classifyElementForPruning(iModel: IModelDb, elementId: Id64String): ElementPruningClassification {\r\n const el = iModel.elements.getElement(elementId);\r\n // DefinitionContainer is submodeled by a DefinitionModel and so it must be classified as PRUNING_CLASS_DefinitionPartition for tree-walking purposes.\r\n // Since DefinitionContainer is-a DefinitionElement the (el instanceof DefinitionElement) case below would classify it as PRUNING_CLASS_Definition.\r\n // That is why we special-case it here.\r\n if (el instanceof DefinitionContainer)\r\n return ElementPruningClassification.PRUNING_CLASS_DefinitionPartition;\r\n return (el instanceof Subject) ? ElementPruningClassification.PRUNING_CLASS_Subject :\r\n (el instanceof DefinitionElement) ? ElementPruningClassification.PRUNING_CLASS_Definition :\r\n (el instanceof DefinitionPartition) ? ElementPruningClassification.PRUNING_CLASS_DefinitionPartition :\r\n ElementPruningClassification.PRUNING_CLASS_Normal;\r\n}\r\n\r\n/** Records the path that a tree search took to reach an element or model. This object is immutable.\r\n * @beta\r\n */\r\nexport class ElementTreeWalkerScope {\r\n public readonly topElement: Id64String = \"\";\r\n /** path of parent elements and enclosing models */\r\n public readonly path: Array<Id64String | ElementTreeWalkerModelInfo> = [];\r\n /** cached info about the immediately enclosing model (i.e., the last model in path) */\r\n public readonly enclosingModelInfo: ElementTreeWalkerModelInfo;\r\n\r\n constructor(topElement: Id64String, model: Model);\r\n constructor(enclosingScope: ElementTreeWalkerScope, newScope: Id64String | Model);\r\n constructor(arg1: Id64String | ElementTreeWalkerScope, arg2: Model | Id64String) {\r\n if (typeof arg1 === \"string\") {\r\n // normal constructor\r\n assert(arg2 instanceof Model);\r\n this.topElement = arg1;\r\n this.path.push(this.enclosingModelInfo = { model: arg2, isDefinitionModel: isDefinitionModel(arg2) });\r\n } else if (arg1 instanceof ElementTreeWalkerScope) {\r\n // copy-like constructor\r\n this.topElement = arg1.topElement;\r\n this.path = [...arg1.path];\r\n if (typeof arg2 === \"string\") {\r\n // with new parent\r\n this.path.push(arg2);\r\n this.enclosingModelInfo = arg1.enclosingModelInfo;\r\n } else {\r\n // with new enclosing model\r\n this.path.push(this.enclosingModelInfo = { model: arg2, isDefinitionModel: isDefinitionModel(arg2) });\r\n }\r\n } else {\r\n throw new Error(\"invalid constructor signature\");\r\n }\r\n }\r\n\r\n public get enclosingModel(): Model { return this.enclosingModelInfo.model; }\r\n public get inDefinitionModel(): boolean { return this.enclosingModelInfo.isDefinitionModel; } // NB: this will return false for the RepositoryModel!\r\n public get inRepositoryModel(): boolean { return this.enclosingModelInfo.model.id === IModelDb.repositoryModelId; }\r\n\r\n public static createTopScope(iModel: IModelDb, topElementId: Id64String) {\r\n const topElement = iModel.elements.getElement(topElementId);\r\n const topElementModel = iModel.models.getModel(topElement.model);\r\n return new ElementTreeWalkerScope(topElementId, topElementModel);\r\n }\r\n\r\n private fmtItem(v: Id64String | ElementTreeWalkerModelInfo): string {\r\n if (typeof v === \"string\")\r\n return `element ${v}`;\r\n return `model ${v.model.id} ${v.isDefinitionModel ? \"(DEFN)\" : \"\"}`;\r\n }\r\n\r\n public toString(): string {\r\n return `[ ${this.path.map((v) => this.fmtItem(v)).join(\" / \")} ]`;\r\n }\r\n}\r\n\r\nfunction fmtElement(iModel: IModelDb, elementId: Id64String): string {\r\n const el = iModel.elements.getElement(elementId);\r\n return `${el.id} ${el.classFullName} ${el.getDisplayLabel()}`;\r\n}\r\n\r\nfunction fmtModel(model: Model): string {\r\n return `${model.id} ${model.classFullName} ${model.name}`;\r\n}\r\n\r\nlet isTraceEnabledChecked = -1;\r\n\r\nfunction isTraceEnabled(): boolean {\r\n if (isTraceEnabledChecked === -1)\r\n isTraceEnabledChecked = Logger.isEnabled(loggerCategory, LogLevel.Trace) ? 1 : 0;\r\n return isTraceEnabledChecked === 1;\r\n}\r\n\r\nfunction logElement(op: string, iModel: IModelDb, elementId: Id64String, scope?: ElementTreeWalkerScope, logChildren?: boolean): void {\r\n if (!isTraceEnabled())\r\n return;\r\n\r\n Logger.logTrace(loggerCategory, `${op} ${fmtElement(iModel, elementId)} ${scope ? scope.toString() : \"\"}`);\r\n\r\n if (logChildren)\r\n iModel.elements.queryChildren(elementId).forEach((c) => logElement(\" - \", iModel, c, undefined, true));\r\n}\r\n\r\nfunction logModel(op: string, iModel: IModelDb, modelId: Id64String, scope?: ElementTreeWalkerScope, logElements?: boolean): void {\r\n if (!isTraceEnabled())\r\n return;\r\n const model: Model = iModel.models.getModel(modelId);\r\n Logger.logTrace(loggerCategory, `${op} ${fmtModel(model)} ${scope ? scope.toString() : \"\"}`);\r\n\r\n if (logElements) {\r\n iModel.withPreparedStatement(`select ecinstanceid from ${Element.classFullName} where Model.Id = ?`, (stmt) => {\r\n stmt.bindId(1, modelId);\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n logElement(\" - \", iModel, stmt.getValue(0).getId());\r\n }\r\n });\r\n }\r\n}\r\n\r\n/** Does a depth-first search on the tree defined by an element and its sub-models and children.\r\n * Sub-models are visited before their modeled elements, and children are visited before their parents.\r\n *\r\n * The following callbacks allow the subclass to exclude elements and sub-trees from the search:\r\n * * [[ElementTreeBottomUp.shouldExploreModel]], [[ElementTreeBottomUp.shouldExploreChildren]]\r\n * * [[ElementTreeBottomUp.shouldVisitElement]], [[ElementTreeBottomUp.shouldVisitModel]]\r\n *\r\n * The [[ElementTreeBottomUp.visitElement]] and [[ElementTreeBottomUp.visitModel]] callbacks allow\r\n * the subclass to process the elements and models that are encountered in the search.\r\n * @beta\r\n */\r\nexport abstract class ElementTreeBottomUp {\r\n constructor(protected _iModel: IModelDb) { }\r\n\r\n /** Return true if the search should recurse into this model */\r\n protected shouldExploreModel(_model: Model, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n /** Return true if the search should recurse into the children (if any) of this element */\r\n protected shouldExploreChildren(_parentId: Id64String, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n /** Return true if the search should visit this element */\r\n protected shouldVisitElement(_elementId: Id64String, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n /** Return true if the search should visit this model */\r\n protected shouldVisitModel(_model: Model, _scope: ElementTreeWalkerScope): boolean { return true; }\r\n\r\n /** Called to visit a model */\r\n protected abstract visitModel(model: Model, scope: ElementTreeWalkerScope): void;\r\n\r\n /** Called to visit an element */\r\n protected abstract visitElement(elementId: Id64String, scope: ElementTreeWalkerScope): void;\r\n\r\n /** The main tree-walking function */\r\n protected processElementTree(element: Id64String, scope: ElementTreeWalkerScope) {\r\n const subModel = this._iModel.models.tryGetModel<Model>(element);\r\n if (subModel !== undefined) {\r\n if (this.shouldExploreModel(subModel, scope))\r\n this._processSubModel(subModel, scope);\r\n\r\n if (this.shouldVisitModel(subModel, scope))\r\n this.visitModel(subModel, scope);\r\n }\r\n\r\n if (this.shouldExploreChildren(element, scope))\r\n this._processChildren(element, scope);\r\n\r\n if (this.shouldVisitElement(element, scope))\r\n this.visitElement(element, scope);\r\n }\r\n\r\n /** process the children of the specified parent element */\r\n private _processChildren(parentElement: Id64String, parentScope: ElementTreeWalkerScope): void {\r\n const children = this._iModel.elements.queryChildren(parentElement);\r\n if (children.length === 0)\r\n return;\r\n\r\n const childrenScope = new ElementTreeWalkerScope(parentScope, parentElement);\r\n\r\n for (const childElement of children)\r\n this.processElementTree(childElement, childrenScope);\r\n }\r\n\r\n /** process the elements in the specified model */\r\n private _processSubModel(model: Model, parenScope: ElementTreeWalkerScope): void {\r\n const scope = new ElementTreeWalkerScope(parenScope, model);\r\n // Visit only the top-level parents. processElementTree will visit their children (bottom-up).\r\n model.iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {\r\n stmt.bindId(1, model.id);\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n const elementId = stmt.getValue(0).getId();\r\n this.processElementTree(elementId, scope);\r\n }\r\n });\r\n }\r\n}\r\n\r\n/** Helper class that manages the deletion of definitions and subjects */\r\nclass SpecialElements {\r\n public definitionModels: Id64Array = [];\r\n public definitions: Id64Array = [];\r\n public subjects: Id64Array = [];\r\n\r\n public recordSpecialElement(iModel: IModelDb, elementId: Id64String): boolean {\r\n // Defer Definitions and Subjects\r\n const cls = classifyElementForPruning(iModel, elementId);\r\n if (cls === ElementPruningClassification.PRUNING_CLASS_Subject) {\r\n this.subjects.push(elementId);\r\n return true;\r\n } else if (cls === ElementPruningClassification.PRUNING_CLASS_Definition) {\r\n this.definitions.push(elementId);\r\n return true;\r\n } else if (cls === ElementPruningClassification.PRUNING_CLASS_DefinitionPartition) {\r\n this.definitionModels.push(elementId);\r\n return true;\r\n }\r\n return false; // not a special element\r\n }\r\n\r\n /** Delete special elements - This calls Elements.deleteDefinitionElements to process the collected definition elements as a group and then\r\n * calls Models.deleteModel on collected definition models. It then deletes all collected Subjects by calling Element.deleteElement on them.\r\n * @note Caller must ensure that the special elements were recorded in a depth-first search.\r\n */\r\n public deleteSpecialElements(iModel: IModelDb) {\r\n // It's dangerous to pass a mixture of SubCategories and Categories to deleteDefinitionElements.\r\n // That function will delete the Categories first, which automatically deletes all their child\r\n // SubCategories (in native code). If a SubCategory in the list is one of those children, then\r\n // deleteDefinitionElements will try and fail with an exception to delete that SubCategory in a subsequent step.\r\n // To work around this, we delete the SubCategories first, then everything else.\r\n // A similar problem occurs when you pass other kinds of elements to deleteDefinitionElements, where some are\r\n // children and others are parents. deleteDefinitionElements does not preserve the order that you specify,\r\n // and it does not process children before parents.\r\n for (const definitions of sortChildrenBeforeParents(iModel, this.definitions)) {\r\n if (isTraceEnabled())\r\n definitions.forEach((e) => logElement(\"try delete\", iModel, e));\r\n\r\n iModel.elements.deleteDefinitionElements(definitions); // will not delete definitions that are still in use.\r\n }\r\n\r\n for (const m of this.definitionModels) {\r\n if (!isModelEmpty(iModel, m)) {\r\n logModel(\"Model not empty - cannot delete - may contain Definitions that are still in use\", iModel, m, undefined, true);\r\n } else {\r\n logModel(\"delete\", iModel, m);\r\n iModel.models.deleteModel(m);\r\n iModel.elements.deleteElement(m);\r\n }\r\n }\r\n\r\n for (const e of this.subjects) {\r\n if (iModel.elements.queryChildren(e).length !== 0) {\r\n logElement(\"Subject still has children - cannot delete - may have child DefinitionModels\", iModel, e, undefined, true);\r\n } else {\r\n logElement(\"delete\", iModel, e);\r\n iModel.elements.deleteElement(e);\r\n }\r\n }\r\n }\r\n\r\n}\r\n\r\n/** Deletes an entire element tree, including sub-models and child elements.\r\n * Items are deleted in bottom-up order. Definitions and Subjects are deleted after normal elements.\r\n * Call deleteNormalElements on each tree. Then call deleteSpecialElements.\r\n * @see deleteElementTree for a simple way to use this class.\r\n * @beta\r\n */\r\nexport class ElementTreeDeleter extends ElementTreeBottomUp {\r\n protected _special: SpecialElements = new SpecialElements();\r\n\r\n protected override shouldExploreModel(_model: Model): boolean { return true; }\r\n protected override shouldVisitElement(_elementId: Id64String): boolean { return true; }\r\n\r\n protected override visitModel(model: Model, _scope: ElementTreeWalkerScope): void {\r\n if (isDefinitionModel(model))\r\n return; // we recorded definition models in visitElement when we encountered the DefinitionPartition elements.\r\n\r\n // visitElement has already deleted the elements in the model. So, now it's safe to delete the model itself.\r\n logModel(\"delete\", this._iModel, model.id, _scope);\r\n model.delete();\r\n }\r\n\r\n protected override visitElement(elementId: Id64String, _scope: ElementTreeWalkerScope): void {\r\n if (!this._special.recordSpecialElement(this._iModel, elementId)) {\r\n logElement(\"delete\", this._iModel, elementId, _scope);\r\n this._iModel.elements.deleteElement(elementId);\r\n }\r\n }\r\n\r\n /**\r\n * Delete the \"normal\" elements and record the special elements for deferred processing.\r\n * @param topElement The parent of the sub-tree to be deleted. Top element itself is also deleted.\r\n * @param scope How the parent was found\r\n * @see deleteSpecialElements\r\n */\r\n public deleteNormalElements(topElement: Id64String, scope?: ElementTreeWalkerScope): void {\r\n const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this._iModel, topElement);\r\n this.processElementTree(topElement, topScope); //\r\n }\r\n\r\n /** Delete all special elements that were found and deferred by deleteNormalElements. Call this\r\n * function once after all element trees are processed by deleteNormalElements.\r\n */\r\n public deleteSpecialElements(): void {\r\n this._special.deleteSpecialElements(this._iModel);\r\n }\r\n\r\n}\r\n\r\n/** Does a breadth-first search on the tree defined by an element and its sub-models and children.\r\n * Parents are visited first, then children, then sub-models.\r\n * The subclass can \"prune\" sub-trees from the search. When a sub-tree is \"pruned\" the search does *not* recurse into it.\r\n * If a sub-tree is not pruned, then the search does recurse into it.\r\n * @beta\r\n */\r\nabstract class ElementTreeTopDown {\r\n constructor(protected _iModel: IModelDb) { }\r\n\r\n /** Should the search *not* recurse into this sub-tree? */\r\n protected shouldPrune(_elementId: Id64String, _scope: ElementTreeWalkerScope): boolean { return false; }\r\n\r\n protected abstract prune(_elementId: Id64String, _scope: ElementTreeWalkerScope): void;\r\n\r\n protected processElementTree(element: Id64String, scope: ElementTreeWalkerScope) {\r\n\r\n if (this.shouldPrune(element, scope)) {\r\n this.prune(element, scope);\r\n return;\r\n }\r\n\r\n this._processChildren(element, scope);\r\n\r\n const subModel = this._iModel.models.tryGetModel<Model>(element);\r\n if (subModel !== undefined) {\r\n this._processSubModel(subModel, scope);\r\n }\r\n }\r\n\r\n private _processChildren(element: Id64String, scope: ElementTreeWalkerScope) {\r\n let parentScope: ElementTreeWalkerScope | undefined;\r\n for (const childElement of this._iModel.elements.queryChildren(element)) {\r\n if (parentScope === undefined)\r\n parentScope = new ElementTreeWalkerScope(scope, element);\r\n this.processElementTree(childElement, parentScope);\r\n }\r\n }\r\n\r\n private _processSubModel(subModel: Model, scope: ElementTreeWalkerScope) {\r\n const subModelScope = new ElementTreeWalkerScope(scope, subModel);\r\n // Visit only the top-level parents. processElementTree will recurse into their children.\r\n this._iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {\r\n stmt.bindId(1, subModel.id);\r\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\r\n const elementId = stmt.getValue(0).getId();\r\n this.processElementTree(elementId, subModelScope);\r\n }\r\n });\r\n }\r\n\r\n}\r\n\r\n/** Signature of the filter function used by ElementSubTreeDeleter.\r\n * @param elementId The sub-tree parent element.\r\n * @param scope The path followed by the top-down search to the element\r\n * @return true if the element and its children and sub-models should be deleted.\r\n * @beta\r\n */\r\nexport type ElementSubTreeDeleteFilter = (elementId: Id64String, scope: ElementTreeWalkerScope) => boolean;\r\n\r\n/** Performs a breadth-first search to visit elements in top-down order.\r\n * When the supplied filter function chooses an element, ElementTreeDeleter is used to delete it and its sub-tree.\r\n * @beta\r\n */\r\nexport class ElementSubTreeDeleter extends ElementTreeTopDown {\r\n private _treeDeleter: ElementTreeDeleter;\r\n private _shouldPruneCb: ElementSubTreeDeleteFilter;\r\n\r\n /** Construct an ElementSubTreeDeleter.\r\n * @param iModel The iModel\r\n * @param topElement Where to start the search.\r\n * @param shouldPruneCb Callback that selects sub-trees that should be deleted.\r\n * @see deleteElementSubTrees for a simple way to use this class.\r\n */\r\n public constructor(iModel: IModelDb, shouldPruneCb: ElementSubTreeDeleteFilter) {\r\n super(iModel);\r\n this._treeDeleter = new ElementTreeDeleter(this._iModel);\r\n this._shouldPruneCb = shouldPruneCb;\r\n }\r\n\r\n protected override shouldPrune(elementId: Id64String, scope: ElementTreeWalkerScope): boolean { return this._shouldPruneCb(elementId, scope); }\r\n\r\n protected prune(elementId: Id64String, scope: ElementTreeWalkerScope): void {\r\n this._treeDeleter.deleteNormalElements(elementId, scope);\r\n }\r\n\r\n /** Traverses the tree of elements beginning with the top element, and deletes all selected sub-trees.\r\n * Normal elements are deleted. Any special elements that are encountered are deferred.\r\n * Call deleteSpecialElementSubTrees after all top elements have been processed. */\r\n public deleteNormalElementSubTrees(topElement: Id64String, scope?: ElementTreeWalkerScope) {\r\n const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this._iModel, topElement);\r\n this.processElementTree(topElement, topScope); // deletes normal elements and their sub-trees, defers special elements\r\n }\r\n\r\n /** Delete all special elements and their sub-trees that were found in the course of processing.\r\n * The sub-trees were already expanded by ElementTreeDeleter.deleteNormalElements.\r\n */\r\n public deleteSpecialElementSubTrees() {\r\n this._treeDeleter.deleteSpecialElements();\r\n }\r\n}\r\n\r\n/** Arguments supplied to [[deleteElementTree]].\r\n * @beta\r\n */\r\nexport interface DeleteElementTreeArgs {\r\n /** The iModel containing the elements to delete. */\r\n iModel: IModelDb;\r\n /** The Id of the root element of the tree to delete. */\r\n topElement: Id64String;\r\n /** The maximum number of passes to make when deleting definition elements.\r\n * Default: 5\r\n */\r\n maxPasses?: number;\r\n}\r\n\r\n/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.\r\n * @param iModel The iModel\r\n * @param topElement The parent of the sub-tree\r\n * @beta\r\n */\r\nexport function deleteElementTree(iModel: IModelDb, topElement: Id64String): void;\r\n/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.\r\n * @param args Specifies the iModel and top element.\r\n * @beta\r\n */\r\nexport function deleteElementTree(args: DeleteElementTreeArgs): void;\r\n/** @internal */\r\nexport function deleteElementTree(arg0: DeleteElementTreeArgs | IModelDb, arg1?: Id64String): void {\r\n let maxPasses;\r\n let iModel: IModelDb;\r\n let topElement: Id64String;\r\n if (arg0 instanceof IModelDb) {\r\n assert(typeof arg1 === \"string\");\r\n iModel = arg0;\r\n topElement = arg1;\r\n } else {\r\n iModel = arg0.iModel;\r\n topElement = arg0.topElement;\r\n maxPasses = arg0.maxPasses;\r\n }\r\n\r\n maxPasses = maxPasses ?? 5;\r\n let pass = 0;\r\n do {\r\n const del = new ElementTreeDeleter(iModel);\r\n del.deleteNormalElements(topElement);\r\n del.deleteSpecialElements();\r\n } while ((iModel.elements.tryGetElement(topElement) !== undefined) && (++pass < maxPasses));\r\n}\r\n\r\n/** Deletes all element sub-trees that are selected by the supplied filter. Uses ElementSubTreeDeleter.\r\n * If the filter selects the top element itself, then the entire tree (including the top element) is deleted.\r\n * That has the same effect as calling [[deleteElementTree]] on the top element.\r\n * @note The caller may have to call this function multiple times if there are multiple layers of dependencies among definition elements.\r\n * @param iModel The iModel\r\n * @param topElement Where to start the search.\r\n * @param filter Callback that selects sub-trees that should be deleted.\r\n * @beta\r\n */\r\nexport function deleteElementSubTrees(iModel: IModelDb, topElement: Id64String, filter: ElementSubTreeDeleteFilter): void {\r\n const del = new ElementSubTreeDeleter(iModel, filter);\r\n del.deleteNormalElementSubTrees(topElement);\r\n del.deleteSpecialElementSubTrees();\r\n}\r\n"]}
|
|
1
|
+
{"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U,GAAG,IAAI,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACrB,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAC7B,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;IAC7B,CAAC;IAED,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC;IAC3B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,GAAG,CAAC;QACF,MAAM,GAAG,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAC3C,GAAG,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACrC,GAAG,CAAC,qBAAqB,EAAE,CAAC;IAC9B,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,EAAE;AAC9F,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CAAC,MAAgB,EAAE,UAAsB,EAAE,MAAkC;IAChH,MAAM,GAAG,GAAG,IAAI,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,GAAG,CAAC,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAC5C,GAAG,CAAC,4BAA4B,EAAE,CAAC;AACrC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\nimport { assert, DbResult, Id64Array, Id64String, Logger, LogLevel } from \"@itwin/core-bentley\";\nimport { IModel } from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"./BackendLoggerCategory\";\nimport { DefinitionContainer, DefinitionElement, DefinitionPartition, Element, Subject } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { DefinitionModel, Model } from \"./Model\";\n\nconst loggerCategory = `${BackendLoggerCategory.IModelDb}.ElementTreeWalker`;\n\n/** @beta */\nexport interface ElementTreeWalkerModelInfo { model: Model, isDefinitionModel: boolean }\n\nfunction sortChildrenBeforeParents(iModel: IModelDb, ids: Id64Array): Array<Id64Array> {\n const children: Id64Array = [];\n const parents: Id64Array = [];\n for (const eid of ids) {\n const parentId = iModel.elements.queryParent(eid);\n if (parentId !== undefined && ids.includes(parentId))\n children.push(eid);\n else\n parents.push(eid);\n }\n\n if (children.length === 0)\n return [parents];\n\n return [...sortChildrenBeforeParents(iModel, children), parents];\n}\n\nfunction isModelEmpty(iModel: IModelDb, modelId: Id64String): boolean {\n return iModel.withPreparedStatement(`select count(*) from ${Element.classFullName} where Model.Id = ?`, (stmt) => {\n stmt.bindId(1, modelId);\n stmt.step();\n return stmt.getValue(0).getInteger() === 0;\n });\n}\n\nfunction isDefinitionModel(model: Model): boolean {\n return (model.id !== IModel.repositoryModelId) && (model instanceof DefinitionModel);\n}\n\nenum ElementPruningClassification { PRUNING_CLASS_Normal = 0, PRUNING_CLASS_Subject = 1, PRUNING_CLASS_Definition = 2, PRUNING_CLASS_DefinitionPartition = 3, }\n\nfunction classifyElementForPruning(iModel: IModelDb, elementId: Id64String): ElementPruningClassification {\n const el = iModel.elements.getElement(elementId);\n // DefinitionContainer is submodeled by a DefinitionModel and so it must be classified as PRUNING_CLASS_DefinitionPartition for tree-walking purposes.\n // Since DefinitionContainer is-a DefinitionElement the (el instanceof DefinitionElement) case below would classify it as PRUNING_CLASS_Definition.\n // That is why we special-case it here.\n if (el instanceof DefinitionContainer)\n return ElementPruningClassification.PRUNING_CLASS_DefinitionPartition;\n return (el instanceof Subject) ? ElementPruningClassification.PRUNING_CLASS_Subject :\n (el instanceof DefinitionElement) ? ElementPruningClassification.PRUNING_CLASS_Definition :\n (el instanceof DefinitionPartition) ? ElementPruningClassification.PRUNING_CLASS_DefinitionPartition :\n ElementPruningClassification.PRUNING_CLASS_Normal;\n}\n\n/** Records the path that a tree search took to reach an element or model. This object is immutable.\n * @beta\n */\nexport class ElementTreeWalkerScope {\n public readonly topElement: Id64String = \"\";\n /** path of parent elements and enclosing models */\n public readonly path: Array<Id64String | ElementTreeWalkerModelInfo> = [];\n /** cached info about the immediately enclosing model (i.e., the last model in path) */\n public readonly enclosingModelInfo: ElementTreeWalkerModelInfo;\n\n constructor(topElement: Id64String, model: Model);\n constructor(enclosingScope: ElementTreeWalkerScope, newScope: Id64String | Model);\n constructor(arg1: Id64String | ElementTreeWalkerScope, arg2: Model | Id64String) {\n if (typeof arg1 === \"string\") {\n // normal constructor\n assert(arg2 instanceof Model);\n this.topElement = arg1;\n this.path.push(this.enclosingModelInfo = { model: arg2, isDefinitionModel: isDefinitionModel(arg2) });\n } else if (arg1 instanceof ElementTreeWalkerScope) {\n // copy-like constructor\n this.topElement = arg1.topElement;\n this.path = [...arg1.path];\n if (typeof arg2 === \"string\") {\n // with new parent\n this.path.push(arg2);\n this.enclosingModelInfo = arg1.enclosingModelInfo;\n } else {\n // with new enclosing model\n this.path.push(this.enclosingModelInfo = { model: arg2, isDefinitionModel: isDefinitionModel(arg2) });\n }\n } else {\n throw new Error(\"invalid constructor signature\");\n }\n }\n\n public get enclosingModel(): Model { return this.enclosingModelInfo.model; }\n public get inDefinitionModel(): boolean { return this.enclosingModelInfo.isDefinitionModel; } // NB: this will return false for the RepositoryModel!\n public get inRepositoryModel(): boolean { return this.enclosingModelInfo.model.id === IModelDb.repositoryModelId; }\n\n public static createTopScope(iModel: IModelDb, topElementId: Id64String) {\n const topElement = iModel.elements.getElement(topElementId);\n const topElementModel = iModel.models.getModel(topElement.model);\n return new ElementTreeWalkerScope(topElementId, topElementModel);\n }\n\n private fmtItem(v: Id64String | ElementTreeWalkerModelInfo): string {\n if (typeof v === \"string\")\n return `element ${v}`;\n return `model ${v.model.id} ${v.isDefinitionModel ? \"(DEFN)\" : \"\"}`;\n }\n\n public toString(): string {\n return `[ ${this.path.map((v) => this.fmtItem(v)).join(\" / \")} ]`;\n }\n}\n\nfunction fmtElement(iModel: IModelDb, elementId: Id64String): string {\n const el = iModel.elements.getElement(elementId);\n return `${el.id} ${el.classFullName} ${el.getDisplayLabel()}`;\n}\n\nfunction fmtModel(model: Model): string {\n return `${model.id} ${model.classFullName} ${model.name}`;\n}\n\nlet isTraceEnabledChecked = -1;\n\nfunction isTraceEnabled(): boolean {\n if (isTraceEnabledChecked === -1)\n isTraceEnabledChecked = Logger.isEnabled(loggerCategory, LogLevel.Trace) ? 1 : 0;\n return isTraceEnabledChecked === 1;\n}\n\nfunction logElement(op: string, iModel: IModelDb, elementId: Id64String, scope?: ElementTreeWalkerScope, logChildren?: boolean): void {\n if (!isTraceEnabled())\n return;\n\n Logger.logTrace(loggerCategory, `${op} ${fmtElement(iModel, elementId)} ${scope ? scope.toString() : \"\"}`);\n\n if (logChildren)\n iModel.elements.queryChildren(elementId).forEach((c) => logElement(\" - \", iModel, c, undefined, true));\n}\n\nfunction logModel(op: string, iModel: IModelDb, modelId: Id64String, scope?: ElementTreeWalkerScope, logElements?: boolean): void {\n if (!isTraceEnabled())\n return;\n const model: Model = iModel.models.getModel(modelId);\n Logger.logTrace(loggerCategory, `${op} ${fmtModel(model)} ${scope ? scope.toString() : \"\"}`);\n\n if (logElements) {\n iModel.withPreparedStatement(`select ecinstanceid from ${Element.classFullName} where Model.Id = ?`, (stmt) => {\n stmt.bindId(1, modelId);\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\n logElement(\" - \", iModel, stmt.getValue(0).getId());\n }\n });\n }\n}\n\n/** Does a depth-first search on the tree defined by an element and its sub-models and children.\n * Sub-models are visited before their modeled elements, and children are visited before their parents.\n *\n * The following callbacks allow the subclass to exclude elements and sub-trees from the search:\n * * [[ElementTreeBottomUp.shouldExploreModel]], [[ElementTreeBottomUp.shouldExploreChildren]]\n * * [[ElementTreeBottomUp.shouldVisitElement]], [[ElementTreeBottomUp.shouldVisitModel]]\n *\n * The [[ElementTreeBottomUp.visitElement]] and [[ElementTreeBottomUp.visitModel]] callbacks allow\n * the subclass to process the elements and models that are encountered in the search.\n * @beta\n */\nexport abstract class ElementTreeBottomUp {\n constructor(protected _iModel: IModelDb) { }\n\n /** Return true if the search should recurse into this model */\n protected shouldExploreModel(_model: Model, _scope: ElementTreeWalkerScope): boolean { return true; }\n /** Return true if the search should recurse into the children (if any) of this element */\n protected shouldExploreChildren(_parentId: Id64String, _scope: ElementTreeWalkerScope): boolean { return true; }\n /** Return true if the search should visit this element */\n protected shouldVisitElement(_elementId: Id64String, _scope: ElementTreeWalkerScope): boolean { return true; }\n /** Return true if the search should visit this model */\n protected shouldVisitModel(_model: Model, _scope: ElementTreeWalkerScope): boolean { return true; }\n\n /** Called to visit a model */\n protected abstract visitModel(model: Model, scope: ElementTreeWalkerScope): void;\n\n /** Called to visit an element */\n protected abstract visitElement(elementId: Id64String, scope: ElementTreeWalkerScope): void;\n\n /** The main tree-walking function */\n protected processElementTree(element: Id64String, scope: ElementTreeWalkerScope) {\n const subModel = this._iModel.models.tryGetModel<Model>(element);\n if (subModel !== undefined) {\n if (this.shouldExploreModel(subModel, scope))\n this._processSubModel(subModel, scope);\n\n if (this.shouldVisitModel(subModel, scope))\n this.visitModel(subModel, scope);\n }\n\n if (this.shouldExploreChildren(element, scope))\n this._processChildren(element, scope);\n\n if (this.shouldVisitElement(element, scope))\n this.visitElement(element, scope);\n }\n\n /** process the children of the specified parent element */\n private _processChildren(parentElement: Id64String, parentScope: ElementTreeWalkerScope): void {\n const children = this._iModel.elements.queryChildren(parentElement);\n if (children.length === 0)\n return;\n\n const childrenScope = new ElementTreeWalkerScope(parentScope, parentElement);\n\n for (const childElement of children)\n this.processElementTree(childElement, childrenScope);\n }\n\n /** process the elements in the specified model */\n private _processSubModel(model: Model, parenScope: ElementTreeWalkerScope): void {\n const scope = new ElementTreeWalkerScope(parenScope, model);\n // Visit only the top-level parents. processElementTree will visit their children (bottom-up).\n model.iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {\n stmt.bindId(1, model.id);\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\n const elementId = stmt.getValue(0).getId();\n this.processElementTree(elementId, scope);\n }\n });\n }\n}\n\n/** Helper class that manages the deletion of definitions and subjects */\nclass SpecialElements {\n public definitionModels: Id64Array = [];\n public definitions: Id64Array = [];\n public subjects: Id64Array = [];\n\n public recordSpecialElement(iModel: IModelDb, elementId: Id64String): boolean {\n // Defer Definitions and Subjects\n const cls = classifyElementForPruning(iModel, elementId);\n if (cls === ElementPruningClassification.PRUNING_CLASS_Subject) {\n this.subjects.push(elementId);\n return true;\n } else if (cls === ElementPruningClassification.PRUNING_CLASS_Definition) {\n this.definitions.push(elementId);\n return true;\n } else if (cls === ElementPruningClassification.PRUNING_CLASS_DefinitionPartition) {\n this.definitionModels.push(elementId);\n return true;\n }\n return false; // not a special element\n }\n\n /** Delete special elements - This calls Elements.deleteDefinitionElements to process the collected definition elements as a group and then\n * calls Models.deleteModel on collected definition models. It then deletes all collected Subjects by calling Element.deleteElement on them.\n * @note Caller must ensure that the special elements were recorded in a depth-first search.\n */\n public deleteSpecialElements(iModel: IModelDb) {\n // It's dangerous to pass a mixture of SubCategories and Categories to deleteDefinitionElements.\n // That function will delete the Categories first, which automatically deletes all their child\n // SubCategories (in native code). If a SubCategory in the list is one of those children, then\n // deleteDefinitionElements will try and fail with an exception to delete that SubCategory in a subsequent step.\n // To work around this, we delete the SubCategories first, then everything else.\n // A similar problem occurs when you pass other kinds of elements to deleteDefinitionElements, where some are\n // children and others are parents. deleteDefinitionElements does not preserve the order that you specify,\n // and it does not process children before parents.\n for (const definitions of sortChildrenBeforeParents(iModel, this.definitions)) {\n if (isTraceEnabled())\n definitions.forEach((e) => logElement(\"try delete\", iModel, e));\n\n iModel.elements.deleteDefinitionElements(definitions); // will not delete definitions that are still in use.\n }\n\n for (const m of this.definitionModels) {\n if (!isModelEmpty(iModel, m)) {\n logModel(\"Model not empty - cannot delete - may contain Definitions that are still in use\", iModel, m, undefined, true);\n } else {\n logModel(\"delete\", iModel, m);\n iModel.models.deleteModel(m);\n iModel.elements.deleteElement(m);\n }\n }\n\n for (const e of this.subjects) {\n if (iModel.elements.queryChildren(e).length !== 0) {\n logElement(\"Subject still has children - cannot delete - may have child DefinitionModels\", iModel, e, undefined, true);\n } else {\n logElement(\"delete\", iModel, e);\n iModel.elements.deleteElement(e);\n }\n }\n }\n\n}\n\n/** Deletes an entire element tree, including sub-models and child elements.\n * Items are deleted in bottom-up order. Definitions and Subjects are deleted after normal elements.\n * Call deleteNormalElements on each tree. Then call deleteSpecialElements.\n * @see deleteElementTree for a simple way to use this class.\n * @beta\n */\nexport class ElementTreeDeleter extends ElementTreeBottomUp {\n protected _special: SpecialElements = new SpecialElements();\n\n protected override shouldExploreModel(_model: Model): boolean { return true; }\n protected override shouldVisitElement(_elementId: Id64String): boolean { return true; }\n\n protected override visitModel(model: Model, _scope: ElementTreeWalkerScope): void {\n if (isDefinitionModel(model))\n return; // we recorded definition models in visitElement when we encountered the DefinitionPartition elements.\n\n // visitElement has already deleted the elements in the model. So, now it's safe to delete the model itself.\n logModel(\"delete\", this._iModel, model.id, _scope);\n model.delete();\n }\n\n protected override visitElement(elementId: Id64String, _scope: ElementTreeWalkerScope): void {\n if (!this._special.recordSpecialElement(this._iModel, elementId)) {\n logElement(\"delete\", this._iModel, elementId, _scope);\n this._iModel.elements.deleteElement(elementId);\n }\n }\n\n /**\n * Delete the \"normal\" elements and record the special elements for deferred processing.\n * @param topElement The parent of the sub-tree to be deleted. Top element itself is also deleted.\n * @param scope How the parent was found\n * @see deleteSpecialElements\n */\n public deleteNormalElements(topElement: Id64String, scope?: ElementTreeWalkerScope): void {\n const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this._iModel, topElement);\n this.processElementTree(topElement, topScope); //\n }\n\n /** Delete all special elements that were found and deferred by deleteNormalElements. Call this\n * function once after all element trees are processed by deleteNormalElements.\n */\n public deleteSpecialElements(): void {\n this._special.deleteSpecialElements(this._iModel);\n }\n\n}\n\n/** Does a breadth-first search on the tree defined by an element and its sub-models and children.\n * Parents are visited first, then children, then sub-models.\n * The subclass can \"prune\" sub-trees from the search. When a sub-tree is \"pruned\" the search does *not* recurse into it.\n * If a sub-tree is not pruned, then the search does recurse into it.\n * @beta\n */\nabstract class ElementTreeTopDown {\n constructor(protected _iModel: IModelDb) { }\n\n /** Should the search *not* recurse into this sub-tree? */\n protected shouldPrune(_elementId: Id64String, _scope: ElementTreeWalkerScope): boolean { return false; }\n\n protected abstract prune(_elementId: Id64String, _scope: ElementTreeWalkerScope): void;\n\n protected processElementTree(element: Id64String, scope: ElementTreeWalkerScope) {\n\n if (this.shouldPrune(element, scope)) {\n this.prune(element, scope);\n return;\n }\n\n this._processChildren(element, scope);\n\n const subModel = this._iModel.models.tryGetModel<Model>(element);\n if (subModel !== undefined) {\n this._processSubModel(subModel, scope);\n }\n }\n\n private _processChildren(element: Id64String, scope: ElementTreeWalkerScope) {\n let parentScope: ElementTreeWalkerScope | undefined;\n for (const childElement of this._iModel.elements.queryChildren(element)) {\n if (parentScope === undefined)\n parentScope = new ElementTreeWalkerScope(scope, element);\n this.processElementTree(childElement, parentScope);\n }\n }\n\n private _processSubModel(subModel: Model, scope: ElementTreeWalkerScope) {\n const subModelScope = new ElementTreeWalkerScope(scope, subModel);\n // Visit only the top-level parents. processElementTree will recurse into their children.\n this._iModel.withPreparedStatement(`select ECInstanceId from bis:Element where Model.id=? and Parent.Id is null`, (stmt) => {\n stmt.bindId(1, subModel.id);\n while (stmt.step() === DbResult.BE_SQLITE_ROW) {\n const elementId = stmt.getValue(0).getId();\n this.processElementTree(elementId, subModelScope);\n }\n });\n }\n\n}\n\n/** Signature of the filter function used by ElementSubTreeDeleter.\n * @param elementId The sub-tree parent element.\n * @param scope The path followed by the top-down search to the element\n * @return true if the element and its children and sub-models should be deleted.\n * @beta\n */\nexport type ElementSubTreeDeleteFilter = (elementId: Id64String, scope: ElementTreeWalkerScope) => boolean;\n\n/** Performs a breadth-first search to visit elements in top-down order.\n * When the supplied filter function chooses an element, ElementTreeDeleter is used to delete it and its sub-tree.\n * @beta\n */\nexport class ElementSubTreeDeleter extends ElementTreeTopDown {\n private _treeDeleter: ElementTreeDeleter;\n private _shouldPruneCb: ElementSubTreeDeleteFilter;\n\n /** Construct an ElementSubTreeDeleter.\n * @param iModel The iModel\n * @param topElement Where to start the search.\n * @param shouldPruneCb Callback that selects sub-trees that should be deleted.\n * @see deleteElementSubTrees for a simple way to use this class.\n */\n public constructor(iModel: IModelDb, shouldPruneCb: ElementSubTreeDeleteFilter) {\n super(iModel);\n this._treeDeleter = new ElementTreeDeleter(this._iModel);\n this._shouldPruneCb = shouldPruneCb;\n }\n\n protected override shouldPrune(elementId: Id64String, scope: ElementTreeWalkerScope): boolean { return this._shouldPruneCb(elementId, scope); }\n\n protected prune(elementId: Id64String, scope: ElementTreeWalkerScope): void {\n this._treeDeleter.deleteNormalElements(elementId, scope);\n }\n\n /** Traverses the tree of elements beginning with the top element, and deletes all selected sub-trees.\n * Normal elements are deleted. Any special elements that are encountered are deferred.\n * Call deleteSpecialElementSubTrees after all top elements have been processed. */\n public deleteNormalElementSubTrees(topElement: Id64String, scope?: ElementTreeWalkerScope) {\n const topScope = scope ?? ElementTreeWalkerScope.createTopScope(this._iModel, topElement);\n this.processElementTree(topElement, topScope); // deletes normal elements and their sub-trees, defers special elements\n }\n\n /** Delete all special elements and their sub-trees that were found in the course of processing.\n * The sub-trees were already expanded by ElementTreeDeleter.deleteNormalElements.\n */\n public deleteSpecialElementSubTrees() {\n this._treeDeleter.deleteSpecialElements();\n }\n}\n\n/** Arguments supplied to [[deleteElementTree]].\n * @beta\n */\nexport interface DeleteElementTreeArgs {\n /** The iModel containing the elements to delete. */\n iModel: IModelDb;\n /** The Id of the root element of the tree to delete. */\n topElement: Id64String;\n /** The maximum number of passes to make when deleting definition elements.\n * Default: 5\n */\n maxPasses?: number;\n}\n\n/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.\n * @param iModel The iModel\n * @param topElement The parent of the sub-tree\n * @beta\n */\nexport function deleteElementTree(iModel: IModelDb, topElement: Id64String): void;\n/** Deletes an element tree starting with the specified top element. The top element is also deleted. Uses ElementTreeDeleter.\n * @param args Specifies the iModel and top element.\n * @beta\n */\nexport function deleteElementTree(args: DeleteElementTreeArgs): void;\n/** @internal */\nexport function deleteElementTree(arg0: DeleteElementTreeArgs | IModelDb, arg1?: Id64String): void {\n let maxPasses;\n let iModel: IModelDb;\n let topElement: Id64String;\n if (arg0 instanceof IModelDb) {\n assert(typeof arg1 === \"string\");\n iModel = arg0;\n topElement = arg1;\n } else {\n iModel = arg0.iModel;\n topElement = arg0.topElement;\n maxPasses = arg0.maxPasses;\n }\n\n maxPasses = maxPasses ?? 5;\n let pass = 0;\n do {\n const del = new ElementTreeDeleter(iModel);\n del.deleteNormalElements(topElement);\n del.deleteSpecialElements();\n } while ((iModel.elements.tryGetElement(topElement) !== undefined) && (++pass < maxPasses));\n}\n\n/** Deletes all element sub-trees that are selected by the supplied filter. Uses ElementSubTreeDeleter.\n * If the filter selects the top element itself, then the entire tree (including the top element) is deleted.\n * That has the same effect as calling [[deleteElementTree]] on the top element.\n * @note The caller may have to call this function multiple times if there are multiple layers of dependencies among definition elements.\n * @param iModel The iModel\n * @param topElement Where to start the search.\n * @param filter Callback that selects sub-trees that should be deleted.\n * @beta\n */\nexport function deleteElementSubTrees(iModel: IModelDb, topElement: Id64String, filter: ElementSubTreeDeleteFilter): void {\n const del = new ElementSubTreeDeleter(iModel, filter);\n del.deleteNormalElementSubTrees(topElement);\n del.deleteSpecialElementSubTrees();\n}\n"]}
|
package/lib/cjs/Entity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.js","sourceRoot":"","sources":["../../src/Entity.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuD;AACvD,oDAAyG;AA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;;;;;;OAOG;IACO,mBAAmB,CAAC,aAAiC;QAC7D,OAAO,CAAC,2BAA2B;IACrC,CAAC;CAQF;AArID,wBAqIC","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, EntityReferenceSet, PropertyCallback, PropertyMetaData } from \"@itwin/core-common\";\r\nimport type { IModelDb } from \"./IModelDb\";\r\nimport { Schema } from \"./Schema\";\r\n\r\n/** Represents one of the fundamental building block in an [[IModelDb]]: 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 as const;\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 protected 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 /** Invoke the constructor of the specified `Entity` subclass.\r\n * @internal\r\n */\r\n public static instantiate(subclass: typeof Entity, props: EntityProps, iModel: IModelDb): Entity {\r\n return new subclass(props, iModel);\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) {\r\n this.iModel.forEachMetaData(this.classFullName, true, func, includeCustom);\r\n }\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 /** return whether this Entity class is a subclass of another Entity class\r\n * @note the subclass-ness is checked according to JavaScript inheritance, to check the underlying raw EC class's\r\n * inheritance, you can use [ECClass.is]($ecschema-metadata)\r\n * @note this should have a type of `is<T extends typeof Entity>(otherClass: T): this is T` but can't because of\r\n * typescript's restriction on the `this` type in static methods\r\n */\r\n public static is(otherClass: typeof Entity): boolean {\r\n // inline of @itwin/core-bentley's isSubclassOf due to protected constructor.\r\n return this === otherClass || this.prototype instanceof otherClass;\r\n }\r\n\r\n /** whether this JavaScript class was generated for this ECClass because there was no registered custom implementation\r\n * ClassRegistry overrides this when generating a class\r\n * @internal\r\n */\r\n public static get isGeneratedClass() { return false; }\r\n\r\n /** Get the set of this entity's *entity references*, [EntityReferenceSet]($backend). An *entity reference* is any id\r\n * stored on the entity, in its EC properties or json fields.\r\n * This is important for cloning operations but can be useful in other situations as well.\r\n * @see this.collectReferenceIds\r\n * @beta\r\n */\r\n public getReferenceIds(): EntityReferenceSet {\r\n const referenceIds = new EntityReferenceSet();\r\n this.collectReferenceIds(referenceIds);\r\n return referenceIds;\r\n }\r\n\r\n /** kept rename for older transformer versions\r\n * @deprecated in 3.x . Use [[getReferenceIds]] instead\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n public getReferenceConcreteIds = this.getReferenceIds;\r\n\r\n /** Collect the Ids of this entity's *references* at this level of the class hierarchy.\r\n * A *reference* is any entity referenced by this entity's EC Data, including json fields.\r\n * This is important for cloning operations but can be useful in other situations as well.\r\n * @param _referenceIds The Id64Set to populate with reference Ids.\r\n * @note This should be overridden (with `super` called) at each level the class hierarchy that introduces references.\r\n * @see getReferenceIds\r\n * @beta\r\n */\r\n protected collectReferenceIds(_referenceIds: EntityReferenceSet): void {\r\n return; // no references by default\r\n }\r\n\r\n /** kept rename for older transformer versions\r\n * @deprecated in 3.x . Use [[collectReferenceIds]] instead\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/unbound-method\r\n protected collectReferenceConcreteIds = this.collectReferenceIds;\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 }; // eslint-disable-line @typescript-eslint/no-unsafe-function-type\r\n"]}
|
|
1
|
+
{"version":3,"file":"Entity.js","sourceRoot":"","sources":["../../src/Entity.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuD;AACvD,oDAAyG;AAIzG;;;;GAIG;AACH,MAAa,MAAM;IAQjB,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;IAQ/D,YAAsB,KAAkB,EAAE,MAAgB;QAlC1D;;WAEG;QACa,uBAAkB,GAAG,IAAa,CAAC;QAwGnD;;;WAGG;QACH,6DAA6D;QACtD,4BAAuB,GAAG,IAAI,CAAC,eAAe,CAAC;QActD;;;WAGG;QACH,6DAA6D;QACnD,gCAA2B,GAAG,IAAI,CAAC,mBAAmB,CAAC;QAhG/D,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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AAI,KAAK,UAAU,IAAI,IAAI,CAAC,SAAS,YAAY,UAAU,CAAC;IACrE,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,gBAAgB,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC;IAEtD;;;;;OAKG;IACI,eAAe;QACpB,MAAM,YAAY,GAAG,IAAI,gCAAkB,EAAE,CAAC;QAC9C,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QACvC,OAAO,YAAY,CAAC;IACtB,CAAC;IASD;;;;;;;OAOG;IACO,mBAAmB,CAAC,aAAiC;QAC7D,OAAO,CAAC,2BAA2B;IACrC,CAAC;CAQF;AArID,wBAqIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport { EntityProps, EntityReferenceSet, PropertyCallback, PropertyMetaData } from \"@itwin/core-common\";\nimport type { IModelDb } from \"./IModelDb\";\nimport { Schema } from \"./Schema\";\n\n/** Represents one of the fundamental building block in an [[IModelDb]]: as an [[Element]], [[Model]], or [[Relationship]].\n * Every subclass of Entity represents one BIS [ECClass]($ecschema-metadata).\n * An Entity is typically instantiated from an [EntityProps]($common) and can be converted back to this representation via [[Entity.toJSON]].\n * @public\n */\nexport class Entity {\n /** An immutable property used to discriminate between [[Entity]] and [EntityProps]($common), used to inform the TypeScript compiler that these two types\n * are never substitutable for one another. To obtain an EntityProps from an Entity, use [[Entity.toJSON]].\n */\n public readonly isInstanceOfEntity = true as const;\n /** The Schema that defines this class. */\n public static schema: typeof Schema;\n\n private get _ctor(): typeof Entity { return this.constructor as typeof Entity; }\n\n /** The name of the BIS class associated with this class.\n * @note Every subclass of Entity **MUST** override this method to identify its BIS class.\n * Failure to do so will ordinarily result in an error when the class is registered, since there may only\n * be one JavaScript class for a given BIS class (usually the errant class will collide with its superclass.)\n */\n public static get className(): string { return \"Entity\"; }\n\n /** When working with an Entity it can be useful to set property values directly, bypassing the compiler's type checking.\n * This property makes such code slightly less tedious to read and write.\n * @internal\n */\n public get asAny(): any { return this; }\n\n /** The name of the BIS Schema that defines this class */\n public get schemaName(): string { return this._ctor.schema.schemaName; }\n\n /** The name of the BIS class associated with this class. */\n public get className(): string { return this._ctor.className; }\n\n /** The [[IModelDb]] that contains this Entity */\n public iModel: IModelDb;\n\n /** The Id of this Entity. May be invalid if the Entity has not yet been saved in the database. */\n public id: Id64String;\n\n protected constructor(props: EntityProps, iModel: IModelDb) {\n this.iModel = iModel;\n this.id = Id64.fromJSON(props.id);\n // copy all auto-handled properties from input to the object being constructed\n this.forEachProperty((propName: string, meta: PropertyMetaData) => (this as any)[propName] = meta.createProperty((props as any)[propName]), false);\n }\n\n /** Invoke the constructor of the specified `Entity` subclass.\n * @internal\n */\n public static instantiate(subclass: typeof Entity, props: EntityProps, iModel: IModelDb): Entity {\n return new subclass(props, iModel);\n }\n\n /** Obtain the JSON representation of this Entity. Subclasses of [[Entity]] typically override this method to return their corresponding sub-type of [EntityProps]($common) -\n * for example, [[GeometricElement.toJSON]] returns a [GeometricElementProps]($common).\n */\n public toJSON(): EntityProps {\n const val: any = {};\n val.classFullName = this.classFullName;\n if (Id64.isValid(this.id))\n val.id = this.id;\n this.forEachProperty((propName: string) => val[propName] = (this as any)[propName], false);\n return val;\n }\n\n /** Call a function for each property of this Entity.\n * @param func The callback to be invoked on each property\n * @param includeCustom If true (default), include custom-handled properties in the iteration. Otherwise, skip custom-handled properties.\n * @note Custom-handled properties are core properties that have behavior enforced by C++ handlers.\n */\n public forEachProperty(func: PropertyCallback, includeCustom: boolean = true) {\n this.iModel.forEachMetaData(this.classFullName, true, func, includeCustom);\n }\n\n /** Get the full BIS class name of this Entity in the form \"schema:class\" */\n public static get classFullName(): string { return `${this.schema.schemaName}:${this.className}`; }\n\n /** Get the full BIS class name of this Entity in the form \"schema:class\". */\n public get classFullName(): string { return this._ctor.classFullName; }\n\n /** @internal */\n public static get protectedOperations(): string[] { return []; }\n\n /** return whether this Entity class is a subclass of another Entity class\n * @note the subclass-ness is checked according to JavaScript inheritance, to check the underlying raw EC class's\n * inheritance, you can use [ECClass.is]($ecschema-metadata)\n * @note this should have a type of `is<T extends typeof Entity>(otherClass: T): this is T` but can't because of\n * typescript's restriction on the `this` type in static methods\n */\n public static is(otherClass: typeof Entity): boolean {\n // inline of @itwin/core-bentley's isSubclassOf due to protected constructor.\n return this === otherClass || this.prototype instanceof otherClass;\n }\n\n /** whether this JavaScript class was generated for this ECClass because there was no registered custom implementation\n * ClassRegistry overrides this when generating a class\n * @internal\n */\n public static get isGeneratedClass() { return false; }\n\n /** Get the set of this entity's *entity references*, [EntityReferenceSet]($backend). An *entity reference* is any id\n * stored on the entity, in its EC properties or json fields.\n * This is important for cloning operations but can be useful in other situations as well.\n * @see this.collectReferenceIds\n * @beta\n */\n public getReferenceIds(): EntityReferenceSet {\n const referenceIds = new EntityReferenceSet();\n this.collectReferenceIds(referenceIds);\n return referenceIds;\n }\n\n /** kept rename for older transformer versions\n * @deprecated in 3.x . Use [[getReferenceIds]] instead\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/unbound-method\n public getReferenceConcreteIds = this.getReferenceIds;\n\n /** Collect the Ids of this entity's *references* at this level of the class hierarchy.\n * A *reference* is any entity referenced by this entity's EC Data, including json fields.\n * This is important for cloning operations but can be useful in other situations as well.\n * @param _referenceIds The Id64Set to populate with reference Ids.\n * @note This should be overridden (with `super` called) at each level the class hierarchy that introduces references.\n * @see getReferenceIds\n * @beta\n */\n protected collectReferenceIds(_referenceIds: EntityReferenceSet): void {\n return; // no references by default\n }\n\n /** kept rename for older transformer versions\n * @deprecated in 3.x . Use [[collectReferenceIds]] instead\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/unbound-method\n protected collectReferenceConcreteIds = this.collectReferenceIds;\n}\n\n/** Parameter type that can accept both abstract constructor types and non-abstract constructor types for `instanceof` to test.\n * @public\n */\nexport type EntityClassType<T> = Function & { prototype: T }; // eslint-disable-line @typescript-eslint/no-unsafe-function-type\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityReferences.js","sourceRoot":"","sources":["../../src/EntityReferences.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAwH;AACxH,sDAAuD;AAEvD,mCAAgC;AAChC,uCAAoC;AACpC,mDAAgD;AAChD,iDAAiE;AACjE,iCAAiC;AAcjC;;;GAGG;AACH,IAAiB,gBAAgB,CAkEhC;AAlED,WAAiB,gBAAgB;IAC/B,SAAgB,OAAO,CAAC,EAAmB;QACzC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,iCAAmB,CAAC,KAAK,CAAC;IAC7C,CAAC;IAFe,wBAAO,UAEtB,CAAA;IACD,SAAgB,SAAS,CAAC,EAAmB;QAC3C,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,iCAAmB,CAAC,OAAO,CAAC;IAC/C,CAAC;IAFe,0BAAS,YAExB,CAAA;IACD,SAAgB,eAAe,CAAC,EAAmB;QACjD,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,iCAAmB,CAAC,aAAa,CAAC;IACrD,CAAC;IAFe,gCAAe,kBAE9B,CAAA;IACD,SAAgB,cAAc,CAAC,EAAmB;QAChD,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,iCAAmB,CAAC,YAAY,CAAC;IACpD,CAAC;IAFe,+BAAc,iBAE7B,CAAA;IACD,SAAgB,MAAM,CAAC,EAAmB;QACxC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAFe,uBAAM,SAErB,CAAA;IAED,0DAA0D;IAC1D,SAAgB,KAAK,CAAC,EAAmB;QACvC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAwB,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC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IAAI,WAAW,CAAC,EAAE,CAAC,2BAAY,CAAC;YACnC,OAAO,iCAAmB,CAAC,YAAY,CAAC;;YAExC,MAAM,CAAC,KAAK,EAAE,iEAAiE,CAAC,CAAC;IACrF,CAAC;IAXe,8BAAa,gBAW5B,CAAA;AACH,CAAC,EAlEgB,gBAAgB,gCAAhB,gBAAgB,QAkEhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"EntityReferences.js","sourceRoot":"","sources":["../../src/EntityReferences.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAAwH;AACxH,sDAAuD;AAEvD,mCAAgC;AAChC,uCAAoC;AACpC,mDAAgD;AAChD,iDAAiE;AACjE,iCAAiC;AAcjC;;;GAGG;AACH,IAAiB,gBAAgB,CAkEhC;AAlED,WAAiB,gBAAgB;IAC/B,SAAgB,OAAO,CAAC,EAAmB;QACzC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,iCAAmB,CAAC,KAAK,CAAC;IAC7C,CAAC;IAFe,wBAAO,UAEtB,CAAA;IACD,SAAgB,SAAS,CAAC,EAAmB;QAC3C,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,iCAAmB,CAAC,OAAO,CAAC;IAC/C,CAAC;IAFe,0BAAS,YAExB,CAAA;IACD,SAAgB,eAAe,CAAC,EAAmB;QACjD,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,iCAAmB,CAAC,aAAa,CAAC;IACrD,CAAC;IAFe,gCAAe,kBAE9B,CAAA;IACD,SAAgB,cAAc,CAAC,EAAmB;QAChD,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,iCAAmB,CAAC,YAAY,CAAC;IACpD,CAAC;IAFe,+BAAc,iBAE7B,CAAA;IACD,SAAgB,MAAM,CAAC,EAAmB;QACxC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAFe,uBAAM,SAErB,CAAA;IAED,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CAAmB,CAAC,aAAa,CAAC;aACtC,IAAI,WAAW,CAAC,EAAE,CAAC,aAAK,CAAC;YAC5B,OAAO,iCAAmB,CAAC,KAAK,CAAC;aAC9B,IAAI,WAAW,CAAC,EAAE,CAAC,2BAAY,CAAC;YACnC,OAAO,iCAAmB,CAAC,YAAY,CAAC;;YAExC,MAAM,CAAC,KAAK,EAAE,iEAAiE,CAAC,CAAC;IACrF,CAAC;IAXe,8BAAa,gBAW5B,CAAA;AACH,CAAC,EAlEgB,gBAAgB,gCAAhB,gBAAgB,QAkEhC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Schema\n */\n\nimport { ConcreteEntityTypes, ElementAspectProps, ElementProps, EntityReference, ModelProps } from \"@itwin/core-common\";\nimport { Id64, Id64String } from \"@itwin/core-bentley\";\nimport type { Entity } from \"./Entity\";\nimport { Model } from \"./Model\";\nimport { Element } from \"./Element\";\nimport { ElementAspect } from \"./ElementAspect\";\nimport { Relationship, RelationshipProps } from \"./Relationship\";\nimport * as assert from \"assert\";\n\n/** Concrete classes that can be created, with the notable exception of CodeSpecs since it is does not derive from Entity\n * other entity classes. In the future if there is a need\n * to manage them this way, it can be added\n * @alpha\n */\nexport type ConcreteEntity = Element | Model | ElementAspect | Relationship;\n\n/** Props for a [[ConcreteEntity]]\n * @alpha\n */\nexport type ConcreteEntityProps = ElementProps | ModelProps | ElementAspectProps | RelationshipProps;\n\n/**\n * Utilities for the [EntityReference]($common) type which is a kind of strings\n * @alpha\n */\nexport namespace EntityReferences {\n export function isModel(id: EntityReference) {\n return id[0] === ConcreteEntityTypes.Model;\n }\n export function isElement(id: EntityReference) {\n return id[0] === ConcreteEntityTypes.Element;\n }\n export function isElementAspect(id: EntityReference) {\n return id[0] === ConcreteEntityTypes.ElementAspect;\n }\n export function isRelationship(id: EntityReference) {\n return id[0] === ConcreteEntityTypes.Relationship;\n }\n export function toId64(id: EntityReference) {\n return id.slice(1);\n }\n\n /** split a concrete entity id into its type and raw id */\n export function split(id: EntityReference): [ConcreteEntityTypes, Id64String] {\n return [id[0] as ConcreteEntityTypes, id.slice(1)];\n }\n\n /** used by the transformer to figure out where to check for the existence in a db of a concrete element id\n * @internal\n */\n export function isValid(id: EntityReference): boolean {\n return Id64.isValid(toId64(id));\n }\n\n /** create the invalid id for a concrete entity type\n * @internal\n */\n export function makeInvalid(type: ConcreteEntityTypes): EntityReference {\n return `${type}${Id64.invalid}`;\n }\n\n /** create an EntityReference given an entity */\n export function from(entity: ConcreteEntity): EntityReference {\n const type = typeFromClass(entity.constructor as typeof Entity);\n return `${type}${entity.id}`;\n }\n\n /** create an EntityReference given an id and a JavaScript class */\n export function fromClass(id: Id64String, entityClass: typeof Entity): EntityReference {\n const type = typeFromClass(entityClass);\n return `${type}${id}`;\n }\n\n /** Create an EntityReference quickly from an exact reference type and id */\n export function fromEntityType(id: Id64String, type: ConcreteEntityTypes): EntityReference {\n return `${type}${id}`;\n }\n\n /** @internal the argument entityClass be concrete (i.e. not the Entity abstract base class) */\n export function typeFromClass(entityClass: typeof Entity): ConcreteEntityTypes {\n if (entityClass.is(Element))\n return ConcreteEntityTypes.Element;\n else if (entityClass.is(ElementAspect))\n return ConcreteEntityTypes.ElementAspect;\n else if (entityClass.is(Model))\n return ConcreteEntityTypes.Model;\n else if (entityClass.is(Relationship))\n return ConcreteEntityTypes.Relationship;\n else\n assert(false, \"unknown or abstract entity type passed to EntityReferences.from\");\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportGraphics.js","sourceRoot":"","sources":["../../src/ExportGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoE;AACpE,wDAAgG;AAkQhG;;GAEG;AACH,IAAiB,cAAc,CAuD9B;AAvDD,WAAiB,cAAc;IA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,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 ExportGraphics\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 { ColorDefProps, 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 */\r\n color: ColorDefProps;\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 */\r\n color: ColorDefProps;\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 * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\r\n */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to PI/12 (15 degrees).\r\n */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry).\r\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\r\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\r\n * that it's necessary, it's almost certainly not!)\r\n */\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 */\r\n color: ColorDefProps;\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 */\r\n color: ColorDefProps;\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 * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\r\n */\r\n chordTol?: number;\r\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\r\n * If not supplied, defaults to PI/12 (15 degrees).\r\n */\r\n angleTol?: number;\r\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry)\r\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\r\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\r\n * that it's necessary, it's almost certainly not!)\r\n */\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)\r\n return false;\r\n if (lhs.subCategoryId !== rhs.subCategoryId)\r\n return false;\r\n if (lhs.materialId !== rhs.materialId)\r\n return false;\r\n if (lhs.elmTransparency !== rhs.elmTransparency)\r\n return false;\r\n if (lhs.lineColor !== rhs.lineColor)\r\n 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
|
+
{"version":3,"file":"ExportGraphics.js","sourceRoot":"","sources":["../../src/ExportGraphics.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoE;AACpE,wDAAgG;AAkQhG;;GAEG;AACH,IAAiB,cAAc,CAuD9B;AAvDD,WAAiB,cAAc;IAC7B;;OAEG;IACH,SAAgB,wBAAwB,CAAC,GAA0B,EAAE,GAA0B;QAC7F,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU;Y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AC;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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ExportGraphics\n */\n\nimport { assert, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport { IndexedPolyface, Polyface, PolyfaceData, PolyfaceVisitor } from \"@itwin/core-geometry\";\nimport { ColorDefProps, GeometryClass } from \"@itwin/core-common\";\n\n/** A collection of line segments, suitable for direct use with graphics APIs.\n * The structure of this data matches GL_LINES in OpenGL.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsLines {\n /** Zero-based vertex indices, every two indices represent a line segment */\n indices: Int32Array;\n /** Vertices for these lines, laid out in the pattern XYZXYZ */\n points: Float64Array;\n}\n\n/** Info provided to ExportLinesFunction about linework graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportLinesInfo {\n /** The element ID for the element the graphics originated from */\n elementId: Id64String;\n /** ID for the [SubCategory]($core-backend) for these graphics */\n subCategory: Id64String;\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** The linework for these graphics */\n lines: ExportGraphicsLines;\n}\n\n/** A callback function that receives generated line graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport type ExportLinesFunction = (info: ExportLinesInfo) => void;\n\n/** A triangulated mesh with unified indices, suitable for direct use with graphics APIs.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsMesh {\n /** Zero-based vertex indices, every three indices represent a triangle */\n indices: Int32Array;\n /** Vertices for this mesh, laid out in the pattern XYZXYZ */\n points: Float64Array;\n /** Normals for this mesh, laid out in the pattern XYZXYZ */\n normals: Float32Array;\n /** Parameters (uvs) for this mesh, laid out in the pattern XYXY */\n params: Float32Array;\n /** If true, clients should assume both sides of the mesh are visible and not cull backfaces. */\n isTwoSided: boolean;\n}\n\n/** Info provided to ExportGraphicsFunction about graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsInfo {\n /** The element ID for the element the graphics originated from */\n elementId: Id64String;\n /** ID for the [SubCategory]($core-backend) for these graphics */\n subCategory: Id64String;\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\n materialId?: Id64String;\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\n textureId?: Id64String;\n /** The mesh for these graphics */\n mesh: ExportGraphicsMesh;\n}\n\n/** Information about the base display properties when a [GeometryPart]($core-backend) was\n * referenced. This is intended to be used with [IModelDb.exportPartGraphics]($core-backend).\n * * If two ExportPartInstanceInfo have the same ExportPartDisplayInfos, they will result in the\n * same graphics (with a different transform).\n * * If two ExportPartInstanceInfo have different ExportPartDisplayInfos, they may result in different\n * graphics.\n * @public\n */\nexport interface ExportPartDisplayInfo {\n categoryId: Id64String;\n subCategoryId: Id64String;\n geometryClass: GeometryClass;\n materialId: Id64String;\n elmTransparency: number;\n lineColor: number;\n}\n\n/** Information about references to [GeometryPart]($core-backend) elements found during\n * a call to [IModelDb.exportGraphics]($core-backend).\n * See [IModelDb.exportPartGraphics]($core-backend) for the intended use case.\n * @public\n */\nexport interface ExportPartInstanceInfo {\n /** ID for the [GeometryPart]($core-backend) */\n partId: Id64String;\n /** ID for the element that contained the reference to the [GeometryPart]($core-backend) */\n partInstanceId: Id64String;\n /** The base display properties when the [GeometryPart]($core-backend) was referenced. */\n displayProps: ExportPartDisplayInfo;\n /** A row-major storage 4x3 transform for this instance.\n * See export-gltf under test-apps in the iTwin.js monorepo for a working reference.\n */\n transform?: Float64Array;\n}\n\n/** A callback function that receives generated graphics.\n * See [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport type ExportGraphicsFunction = (info: ExportGraphicsInfo) => void;\n\n/** Parameters for [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport interface ExportGraphicsOptions {\n /** The source elements for the exported graphics */\n elementIdArray: Id64Array;\n /** A function to call for each unique element ID, color and texture combination */\n onGraphics: ExportGraphicsFunction;\n /** An optional function to call if line graphics are desired. */\n onLineGraphics?: ExportLinesFunction;\n /** If supplied, any references to [GeometryPart]($core-backend) elements found will be\n * recorded in this array. In this case, graphics that would result from the GeometryPart\n * will not be supplied via onGraphics. See [IModelDb.exportPartGraphics]($core-backend)\n */\n partInstanceArray?: ExportPartInstanceInfo[];\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\n */\n chordTol?: number;\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to PI/12 (15 degrees).\n */\n angleTol?: number;\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry).\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\n * that it's necessary, it's almost certainly not!)\n */\n maxEdgeLength?: number;\n /** The longest dimension of a line style's largest component must be at least this size in order for\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\n * line strings.\n */\n minLineStyleComponentSize?: number;\n /** Max distance between mesh vertices for them to be collapsed.\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\n * anomalies so it is important to choose an appropriate setting for your use case.\n */\n decimationTol?: number;\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\n * like screws and screw holes.\n */\n minBRepFeatureSize?: number;\n}\n\n/** Info provided to ExportPartFunction about graphics.\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport interface ExportPartInfo {\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** If defined, ID for the [RenderMaterialElement]($core-backend) for these graphics */\n materialId?: Id64String;\n /** If defined, ID for the [Texture]($core-backend) for these graphics */\n textureId?: Id64String;\n /** The mesh for these graphics */\n mesh: ExportGraphicsMesh;\n}\n\n/** A callback function that receives generated graphics for a [GeometryPart]($core-backend).\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport type ExportPartFunction = (info: ExportPartInfo) => void;\n\n/** Info provided to ExportPartFunction about line graphics.\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport interface ExportPartLinesInfo {\n /** The color and transparency for these graphics */\n color: ColorDefProps;\n /** GeometryClass for these graphics */\n geometryClass: GeometryClass;\n /** The linework for these graphics */\n lines: ExportGraphicsLines;\n}\n\n/** A callback function that receives generated line graphics for a [GeometryPart]($core-backend).\n * See [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport type ExportPartLinesFunction = (info: ExportPartLinesInfo) => void;\n\n/** Parameters for [IModelDb.exportPartGraphics]($core-backend)\n * @public\n */\nexport interface ExportPartGraphicsOptions {\n /** The ID for the source [GeometryPart]($core-backend) */\n elementId: Id64String;\n /** The base display properties to use for generating the graphics. This should come from an\n * ExportPartInstanceProps generated by [IModelDb.exportGraphics]($core-backend)\n */\n displayProps: ExportPartDisplayInfo;\n /** A function to call for each unique color and texture combination. */\n onPartGraphics: ExportPartFunction;\n /** An optional function to call if line graphics are desired. */\n onPartLineGraphics?: ExportPartLinesFunction;\n /** Max distance from a face to the original geometry, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to zero and angleTol will control the quality of the resulting mesh.\n */\n chordTol?: number;\n /** Max angle difference in radians for approximated face, see [StrokeOptions]($core-geometry).\n * If not supplied, defaults to PI/12 (15 degrees).\n */\n angleTol?: number;\n /** Max length of any edge in generated faces, see [StrokeOptions]($core-geometry)\n * If not supplied, there is no maximum length of an edge. Supplying this value can greatly increase the\n * size of the resulting geometry, and should only be done in cases where necessary (if you don't know\n * that it's necessary, it's almost certainly not!)\n */\n maxEdgeLength?: number;\n /** The longest dimension of a line style's largest component must be at least this size in order for\n * exportGraphics to evaluate and generate its graphics. If undefined, this defaults to 0.1.\n * Line styles can evaluate to 3D geometry that clients expect to receive from exportGraphics, but they\n * can also generate gigabytes of mesh data when line styles with small components are applied to long\n * line strings.\n */\n minLineStyleComponentSize?: number;\n /** Max distance between mesh vertices for them to be collapsed.\n * Meshes stored in GeometryStreams are unaffected by StrokeOptions settings. If decimationTol is undefined,\n * they are output from exportGraphics without any reduction in quality and can be too detailed for\n * some uses. However, decimation is a destructive operation that can introduce gaps and other visual\n * anomalies so it is important to choose an appropriate setting for your use case.\n */\n decimationTol?: number;\n /** BRep features with bounding boxes smaller than this size will not generate graphics.\n * This option can be used to ignore expensive details from [BRepEntity.DataProps]($core-common)\n * like screws and screw holes.\n */\n minBRepFeatureSize?: number;\n}\n\n/** Provides utility functions for working with data generated by [IModelDb.exportGraphics]($core-backend)\n * @public\n */\nexport namespace ExportGraphics {\n /** Test if ExportPartDisplayInfos have exactly the same values.\n * @public\n */\n export function arePartDisplayInfosEqual(lhs: ExportPartDisplayInfo, rhs: ExportPartDisplayInfo): boolean {\n if (lhs.categoryId !== rhs.categoryId)\n return false;\n if (lhs.subCategoryId !== rhs.subCategoryId)\n return false;\n if (lhs.materialId !== rhs.materialId)\n return false;\n if (lhs.elmTransparency !== rhs.elmTransparency)\n return false;\n if (lhs.lineColor !== rhs.lineColor)\n return false;\n return true;\n }\n\n /**\n * Convert an ExportGraphicsMesh to an IndexedPolyface usable by the geometry API.\n * @note The resulting IndexedPolyface may have duplicate points, normals and params. If problematic, call [PolyfaceData.compress]($core-geometry)\n * @public\n */\n export function convertToIndexedPolyface(mesh: ExportGraphicsMesh): IndexedPolyface {\n const polyface = IndexedPolyface.create(true, true, false, mesh.isTwoSided);\n\n const p: Float64Array = mesh.points;\n for (let i = 0; i < p.length; i += 3)\n polyface.data.point.pushXYZ(p[i], p[i + 1], p[i + 2]);\n\n const n: Float32Array = mesh.normals;\n assert(undefined !== polyface.data.normal);\n for (let i = 0; i < n.length; i += 3)\n polyface.data.normal.pushXYZ(n[i], n[i + 1], n[i + 2]);\n\n const uv: Float32Array = mesh.params;\n assert(undefined !== polyface.data.param);\n for (let i = 0; i < uv.length; i += 2)\n polyface.data.param.pushXY(uv[i], uv[i + 1]);\n\n const indices = mesh.indices;\n const addIndex = (idx: number) => {\n polyface.addPointIndex(idx, true);\n polyface.addNormalIndex(idx);\n polyface.addParamIndex(idx);\n };\n for (let i = 0; i < indices.length; i += 3) {\n addIndex(indices[i]);\n addIndex(indices[i + 1]);\n addIndex(indices[i + 2]);\n polyface.terminateFacet(false);\n }\n\n return polyface;\n }\n}\n/**\n * * Iterator to walk the facets of an ExportGraphicsMesh and present them to the world as if visiting a Polyface.\n * * Because the ExportGraphicsMesh has limited data:\n * * There is no auxData in this visitor.\n * * There is no color in this visitor.\n * * All edgeVisible are true.\n * @public\n */\nexport class ExportGraphicsMeshVisitor extends PolyfaceData implements PolyfaceVisitor {\n private _currentFacetIndex: number;\n private _nextFacetIndex: number;\n private _numWrap: number;\n private _polyface: ExportGraphicsMesh;\n // to be called from static factory method that validates the polyface ...\n private constructor(facets: ExportGraphicsMesh, numWrap: number) {\n super(facets.normals.length > 0, facets.params.length > 0, false, facets.isTwoSided);\n this._polyface = facets;\n this._numWrap = numWrap;\n\n this._nextFacetIndex = 0;\n this._currentFacetIndex = -1;\n this.twoSided = facets.isTwoSided;\n this.reset();\n }\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\n * Typical wrap counts are:\n * * 0 -- leave the point arrays with \"missing final edge\"\n * * 1 -- add point 0 as closure point\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.\n */\n public static create(polyface: ExportGraphicsMesh, numWrap: number): ExportGraphicsMeshVisitor {\n return new ExportGraphicsMeshVisitor(polyface, numWrap);\n }\n /** Reset the iterator to start at the first facet of the polyface. */\n public reset(): void {\n this.moveToReadIndex(0);\n this._nextFacetIndex = 0; // so immediate moveToNextFacet stays here.\n }\n /** Select a facet by simple index. */\n public moveToReadIndex(facetIndex: number): boolean {\n if (facetIndex < 0 || 2 + facetIndex * 3 >= this._polyface.indices.length)\n return false;\n this._currentFacetIndex = facetIndex;\n this._nextFacetIndex = facetIndex + 1;\n this.point.length = 0;\n const points = this.point;\n points.length = 0;\n this.pointIndex.length = 0;\n this.point.length = 0;\n this.edgeVisible.length = 0;\n const sourcePoints = this._polyface.points;\n const indices = this._polyface.indices;\n const i0 = 3 * facetIndex;\n for (let i = i0; i < i0 + 3; i++) {\n const k = 3 * indices[i];\n this.pointIndex.push(indices[i]);\n this.point.pushXYZ(sourcePoints[k], sourcePoints[k + 1], sourcePoints[k + 2]);\n this.edgeVisible.push(true);\n }\n for (let i = 0; i < this._numWrap; i++) {\n this.point.pushFromGrowableXYZArray(this.point, i);\n }\n\n const sourceParams = this._polyface.params;\n if (sourceParams.length > 0 && this.paramIndex && this.param) {\n this.paramIndex.length = 0;\n this.param.length = 0;\n for (let i = i0; i < i0 + 3; i++) {\n const k = 2 * indices[i];\n this.paramIndex.push(indices[i]);\n this.param.pushXY(sourceParams[k], sourceParams[k + 1]);\n }\n for (let i = 0; i < this._numWrap; i++) {\n this.param.pushFromGrowableXYArray(this.param, i);\n }\n }\n\n const sourceNormals = this._polyface.normals;\n if (sourceNormals.length > 0 && this.normalIndex && this.normal) {\n this.normalIndex.length = 0;\n this.normal.length = 0;\n for (let i = i0; i < i0 + 3; i++) {\n const k = 3 * indices[i];\n this.normalIndex.push(indices[i]);\n this.normal.pushXYZ(sourceNormals[k], sourceNormals[k + 1], sourceNormals[k + 2]);\n }\n for (let i = 0; i < this._numWrap; i++) {\n this.normal.pushFromGrowableXYZArray(this.normal, i);\n }\n }\n return true;\n }\n public moveToNextFacet(): boolean {\n return this.moveToReadIndex(this._nextFacetIndex);\n }\n /** Set the number of vertices to replicate in visitor arrays. */\n public setNumWrap(numWrap: number): void { this._numWrap = numWrap; }\n\n /** Return the index (in the client polyface) of the current facet */\n public currentReadIndex(): number { return this._currentFacetIndex; }\n /** Return the point index of vertex i within the currently loaded facet */\n public clientPointIndex(i: number): number { return this.pointIndex[i]; }\n /** Return the param index of vertex i within the currently loaded facet.\n * Use the artificial paramIndex, which matches pointIndex.\n */\n public clientParamIndex(i: number): number { return this.paramIndex ? this.paramIndex[i] : -1; }\n /** Return the normal index of vertex i within the currently loaded facet.\n * Use the artificial paramIndex, which matches pointIndex.\n */\n public clientNormalIndex(i: number): number { return this.normalIndex ? this.normalIndex[i] : -1; }\n /** Return the color index of vertex i within the currently loaded facet */\n public clientColorIndex(_i: number): number { return 1; }\n /** Return the aux data index of vertex i within the currently loaded facet */\n public clientAuxIndex(_i: number): number { return -1; }\n\n /** return the client polyface */\n public clientPolyface(): Polyface { return (undefined as unknown) as Polyface; }\n /** clear the contents of all arrays. Use this along with transferDataFrom methods to build up new facets */\n public clearArrays(): void {\n if (this.point !== undefined)\n this.point.length = 0;\n if (this.param !== undefined)\n this.param.length = 0;\n if (this.normal !== undefined)\n this.normal.length = 0;\n // ignore color and aux -- they never exist.\n }\n /** transfer interpolated data from the other visitor.\n * * all data values are interpolated at `fraction` between `other` values at index0 and index1.\n */\n public pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void {\n this.point.pushInterpolatedFromGrowableXYZArray(other.point, index0, fraction, index1);\n if (this.param && other.param && index0 < other.param.length && index1 < other.param.length)\n this.param.pushInterpolatedFromGrowableXYArray(other.param, index0, fraction, index1);\n if (this.normal && other.normal && index0 < other.normal.length && index1 < other.normal.length)\n this.normal.pushInterpolatedFromGrowableXYZArray(other.normal, index0, fraction, index1);\n }\n /** transfer data from a specified index of the other visitor as new data in this visitor. */\n public pushDataFrom(other: PolyfaceVisitor, index: number): void {\n this.point.pushFromGrowableXYZArray(other.point, index);\n if (this.color && other.color && index < other.color.length)\n this.color.push(other.color[index]);\n if (this.param && other.param && index < other.param.length)\n this.param.pushFromGrowableXYArray(other.param, index);\n if (this.normal && other.normal && index < other.normal.length)\n this.normal.pushFromGrowableXYZArray(other.normal, index);\n }\n\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSource.js","sourceRoot":"","sources":["../../src/ExternalSource.ts"],"names":[],"mappings":";AACA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAA+C;AAC/C,oDAG4B;AAC5B,uCAAiE;AAEjE,qEAAgH;AAEhH;;;GAGG;AACH,MAAa,cAAe,SAAQ,qCAA2B;IAO7D,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC;IAE3E,YAAsB,KAA0B,EAAE,MAA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AAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAClF,CAAC;CACF;AApDD,4DAoDC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,cAAc;IACrD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAEhF,YAAsB,KAA0B,EAAE,MAAgB;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAPD,kDAOC;AAED;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,iBAAO;IAGpD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,2BAA2B,CAAC,CAAC,CAAC;IAEtF,YAAsB,KAAqC,EAAE,MAAgB;QAC3E,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IAEe,MAAM;QACpB,OAAO,KAAK,CAAC,MAAM,EAAoC,CAAC,CAAC,sDAAsD;IACjH,CAAC;CACF;AAbD,8DAaC","sourcesContent":["\r\n/*---------------------------------------------------------------------------------------------\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 Elements\r\n */\r\n\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { Point3d } from \"@itwin/core-geometry\";\r\nimport {\r\n BisCodeSpec, Code, CodeScopeSpec, EntityReferenceSet, ExternalSourceAttachmentProps, ExternalSourceAttachmentRole, ExternalSourceProps, IModel, RelatedElement,\r\n SynchronizationConfigLinkProps,\r\n} from \"@itwin/core-common\";\r\nimport { InformationReferenceElement, UrlLink } from \"./Element\";\r\nimport { IModelDb } from \"./IModelDb\";\r\nimport { ExternalSourceAttachmentAttachesSource, ExternalSourceIsInRepository } from \"./NavigationRelationship\";\r\n\r\n/** An ExternalSource refers to an 'information container' found in a repository. In some cases, the container is the entire repository.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSource extends InformationReferenceElement {\r\n /** The repository that contains this ExternalSource. */\r\n public repository?: ExternalSourceIsInRepository;\r\n /** The name of the iModel Connecter that processed this ExternalSource. */\r\n public connectorName?: string;\r\n /** The version of the iModel Connecter that processed this ExternalSource. */\r\n public connectorVersion?: string;\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSource\"; }\r\n\r\n protected constructor(props: ExternalSourceProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n if (props.repository)\r\n this.repository = new ExternalSourceIsInRepository(RelatedElement.idFromJson(props.repository));\r\n }\r\n\r\n public override toJSON(): ExternalSourceProps { // This override only specializes the return type\r\n return super.toJSON() as ExternalSourceProps; // Entity.toJSON takes care of auto-handled properties\r\n }\r\n /** The [[CodeSpec]] for ExternalSource elements is not automatically created, so this method ensures that it exists. */\r\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\r\n try {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\r\n return codeSpec.id;\r\n } catch {\r\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSource, CodeScopeSpec.Type.Repository);\r\n }\r\n }\r\n /** Create a Code for an ExternalSource element given a name that is meant to be unique within the scope of the iModel.\r\n * @param iModelDb The IModelDb\r\n * @param codeValue The ExternalSource name\r\n * @see [[ensureCodeSpec]]\r\n */\r\n public static createCode(iModelDb: IModelDb, codeValue: string): Code {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\r\n return new Code({ spec: codeSpec.id, scope: IModel.rootSubjectId, value: codeValue });\r\n }\r\n\r\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\r\n super.collectReferenceIds(referenceIds);\r\n if (this.repository)\r\n referenceIds.addElement(this.repository.id);\r\n }\r\n}\r\n\r\n/** Attachment of an ExternalSource\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceAttachment extends InformationReferenceElement {\r\n /** The [[ExternalSource]] that is attached by this ExternalSourceAttachment. */\r\n public attaches?: ExternalSourceAttachmentAttachesSource;\r\n /** Specifies whether the attached [[ExternalSource]] provides context or models a part of the whole. */\r\n public role?: ExternalSourceAttachmentRole;\r\n /** The translation or offset in global coordinates of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public translation?: Point3d;\r\n /** The Yaw angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public yaw?: number;\r\n /** The Pitch angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public pitch?: number;\r\n /** The Roll angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public roll?: number;\r\n /** The scale of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\r\n public scale?: Point3d;\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceAttachment\"; }\r\n\r\n protected constructor(props: ExternalSourceAttachmentProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n if (props.attaches)\r\n this.attaches = new ExternalSourceAttachmentAttachesSource(RelatedElement.idFromJson(props.attaches));\r\n\r\n if (props.translation)\r\n this.translation = Point3d.fromJSON(props.translation);\r\n\r\n if (props.scale)\r\n this.scale = Point3d.fromJSON(props.scale);\r\n }\r\n\r\n public override toJSON(): ExternalSourceAttachmentProps { // This override only specializes the return type\r\n return super.toJSON() as ExternalSourceAttachmentProps; // Entity.toJSON takes care of auto-handled properties\r\n }\r\n /** The [[CodeSpec]] for ExternalSourceAttachment elements is not automatically created, so this method ensures that it exists. */\r\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\r\n try {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\r\n return codeSpec.id;\r\n } catch {\r\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSourceAttachment, CodeScopeSpec.Type.ParentElement);\r\n }\r\n }\r\n /** Create a Code for an ExternalSourceAttachment element given a name that is meant to be unique within the scope of its parent [[ExternalSource]].\r\n * @param iModelDb The IModelDb\r\n * @param scopeElementId The parent ExternalSource\r\n * @param codeValue The ExternalSourceAttachment name\r\n * @see [[ensureCodeSpec]]\r\n */\r\n public static createCode(iModelDb: IModelDb, scopeElementId: Id64String, codeValue: string): Code {\r\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\r\n return new Code({ spec: codeSpec.id, scope: scopeElementId, value: codeValue });\r\n }\r\n}\r\n\r\n/** A group of ExternalSources that are collectively a source of information for one or more elements.\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class ExternalSourceGroup extends ExternalSource {\r\n /** @internal */\r\n public static override get className(): string { return \"ExternalSourceGroup\"; }\r\n\r\n protected constructor(props: ExternalSourceProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n}\r\n\r\n/** Link to the Configuration for an iModel Synchronization Job\r\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\r\n * @beta\r\n */\r\nexport class SynchronizationConfigLink extends UrlLink {\r\n /** Date/Time of last successful run of this synchronization configuration */\r\n public lastSuccessfulRun?: string;\r\n /** @internal */\r\n public static override get className(): string { return \"SynchronizationConfigLink\"; }\r\n\r\n protected constructor(props: SynchronizationConfigLinkProps, iModel: IModelDb) {\r\n super(props, iModel);\r\n }\r\n\r\n public override toJSON(): SynchronizationConfigLinkProps { // This override only specializes the return type\r\n return super.toJSON() as SynchronizationConfigLinkProps; // Entity.toJSON takes care of auto-handled properties\r\n }\r\n}\r\n\r\n"]}
|
|
1
|
+
{"version":3,"file":"ExternalSource.js","sourceRoot":"","sources":["../../src/ExternalSource.ts"],"names":[],"mappings":";AACA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAA+C;AAC/C,oDAG4B;AAC5B,uCAAiE;AAEjE,qEAAgH;AAEh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0B,EAAE,SAAiB;QACxF,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,yBAAW,CAAC,wBAAwB,CAAC,CAAC;QACpF,OAAO,IAAI,kBAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAClF,CAAC;CACF;AApDD,4DAoDC;AAED;;;GAGG;AACH,MAAa,mBAAoB,SAAQ,cAAc;IACrD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,qBAAqB,CAAC,CAAC,CAAC;IAEhF,YAAsB,KAA0B,EAAE,MAAgB;QAChE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;CACF;AAPD,kDAOC;AAED;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,iBAAO;IAGpD,gBAAgB;IACT,MAAM,KAAc,SAAS,KAAa,OAAO,2BAA2B,CAAC,CAAC,CAAC;IAEtF,YAAsB,KAAqC,EAAE,MAAgB;QAC3E,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvB,CAAC;IAEe,MAAM;QACpB,OAAO,KAAK,CAAC,MAAM,EAAoC,CAAC,CAAC,sDAAsD;IACjH,CAAC;CACF;AAbD,8DAaC","sourcesContent":["\n/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Elements\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { Point3d } from \"@itwin/core-geometry\";\nimport {\n BisCodeSpec, Code, CodeScopeSpec, EntityReferenceSet, ExternalSourceAttachmentProps, ExternalSourceAttachmentRole, ExternalSourceProps, IModel, RelatedElement,\n SynchronizationConfigLinkProps,\n} from \"@itwin/core-common\";\nimport { InformationReferenceElement, UrlLink } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { ExternalSourceAttachmentAttachesSource, ExternalSourceIsInRepository } from \"./NavigationRelationship\";\n\n/** An ExternalSource refers to an 'information container' found in a repository. In some cases, the container is the entire repository.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSource extends InformationReferenceElement {\n /** The repository that contains this ExternalSource. */\n public repository?: ExternalSourceIsInRepository;\n /** The name of the iModel Connecter that processed this ExternalSource. */\n public connectorName?: string;\n /** The version of the iModel Connecter that processed this ExternalSource. */\n public connectorVersion?: string;\n /** @internal */\n public static override get className(): string { return \"ExternalSource\"; }\n\n protected constructor(props: ExternalSourceProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.repository)\n this.repository = new ExternalSourceIsInRepository(RelatedElement.idFromJson(props.repository));\n }\n\n public override toJSON(): ExternalSourceProps { // This override only specializes the return type\n return super.toJSON() as ExternalSourceProps; // Entity.toJSON takes care of auto-handled properties\n }\n /** The [[CodeSpec]] for ExternalSource elements is not automatically created, so this method ensures that it exists. */\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\n try {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\n return codeSpec.id;\n } catch {\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSource, CodeScopeSpec.Type.Repository);\n }\n }\n /** Create a Code for an ExternalSource element given a name that is meant to be unique within the scope of the iModel.\n * @param iModelDb The IModelDb\n * @param codeValue The ExternalSource name\n * @see [[ensureCodeSpec]]\n */\n public static createCode(iModelDb: IModelDb, codeValue: string): Code {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSource);\n return new Code({ spec: codeSpec.id, scope: IModel.rootSubjectId, value: codeValue });\n }\n\n protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {\n super.collectReferenceIds(referenceIds);\n if (this.repository)\n referenceIds.addElement(this.repository.id);\n }\n}\n\n/** Attachment of an ExternalSource\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceAttachment extends InformationReferenceElement {\n /** The [[ExternalSource]] that is attached by this ExternalSourceAttachment. */\n public attaches?: ExternalSourceAttachmentAttachesSource;\n /** Specifies whether the attached [[ExternalSource]] provides context or models a part of the whole. */\n public role?: ExternalSourceAttachmentRole;\n /** The translation or offset in global coordinates of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public translation?: Point3d;\n /** The Yaw angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public yaw?: number;\n /** The Pitch angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public pitch?: number;\n /** The Roll angle (in degrees) of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public roll?: number;\n /** The scale of the attached [[ExternalSource]] relative to the ExternalSource that attaches it. */\n public scale?: Point3d;\n /** @internal */\n public static override get className(): string { return \"ExternalSourceAttachment\"; }\n\n protected constructor(props: ExternalSourceAttachmentProps, iModel: IModelDb) {\n super(props, iModel);\n if (props.attaches)\n this.attaches = new ExternalSourceAttachmentAttachesSource(RelatedElement.idFromJson(props.attaches));\n\n if (props.translation)\n this.translation = Point3d.fromJSON(props.translation);\n\n if (props.scale)\n this.scale = Point3d.fromJSON(props.scale);\n }\n\n public override toJSON(): ExternalSourceAttachmentProps { // This override only specializes the return type\n return super.toJSON() as ExternalSourceAttachmentProps; // Entity.toJSON takes care of auto-handled properties\n }\n /** The [[CodeSpec]] for ExternalSourceAttachment elements is not automatically created, so this method ensures that it exists. */\n public static ensureCodeSpec(iModelDb: IModelDb): Id64String {\n try {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\n return codeSpec.id;\n } catch {\n return iModelDb.codeSpecs.insert(BisCodeSpec.externalSourceAttachment, CodeScopeSpec.Type.ParentElement);\n }\n }\n /** Create a Code for an ExternalSourceAttachment element given a name that is meant to be unique within the scope of its parent [[ExternalSource]].\n * @param iModelDb The IModelDb\n * @param scopeElementId The parent ExternalSource\n * @param codeValue The ExternalSourceAttachment name\n * @see [[ensureCodeSpec]]\n */\n public static createCode(iModelDb: IModelDb, scopeElementId: Id64String, codeValue: string): Code {\n const codeSpec = iModelDb.codeSpecs.getByName(BisCodeSpec.externalSourceAttachment);\n return new Code({ spec: codeSpec.id, scope: scopeElementId, value: codeValue });\n }\n}\n\n/** A group of ExternalSources that are collectively a source of information for one or more elements.\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class ExternalSourceGroup extends ExternalSource {\n /** @internal */\n public static override get className(): string { return \"ExternalSourceGroup\"; }\n\n protected constructor(props: ExternalSourceProps, iModel: IModelDb) {\n super(props, iModel);\n }\n}\n\n/** Link to the Configuration for an iModel Synchronization Job\n * @note The associated ECClass was added to the BisCore schema in version 1.0.13\n * @beta\n */\nexport class SynchronizationConfigLink extends UrlLink {\n /** Date/Time of last successful run of this synchronization configuration */\n public lastSuccessfulRun?: string;\n /** @internal */\n public static override get className(): string { return \"SynchronizationConfigLink\"; }\n\n protected constructor(props: SynchronizationConfigLinkProps, iModel: IModelDb) {\n super(props, iModel);\n }\n\n public override toJSON(): SynchronizationConfigLinkProps { // This override only specializes the return type\n return super.toJSON() as SynchronizationConfigLinkProps; // Entity.toJSON takes care of auto-handled properties\n }\n}\n\n"]}
|