@itwin/core-backend
Version:
iTwin.js backend components
92 lines • 4.95 kB
TypeScript
/** @packageDocumentation
* @module iModels
*/
import { Id64String } from "@itwin/core-bentley";
import { ElementProps } from "@itwin/core-common";
import { IModelJsNative } from "@bentley/imodeljs-native";
import { Element } from "./Element";
import { IModelDb } from "./IModelDb";
import { SQLiteDb } from "./SQLiteDb";
/** The context for transforming a *source* Element to a *target* Element and remapping internal identifiers to the target iModel.
* @beta
*/
export declare class IModelElementCloneContext {
/** The source IModelDb. */
readonly sourceDb: IModelDb;
/** The target IModelDb. */
readonly targetDb: IModelDb;
/** The native import context */
private _nativeContext;
/** Construct a new IModelElementCloneContext. It must be initialized with `initialize`, consider using [[IModelElementCloneContext.create]] instead
* @param sourceDb The source IModelDb.
* @param targetDb If provided the target IModelDb. If not provided, the source and target are the same IModelDb.
*/
constructor(sourceDb: IModelDb, targetDb?: IModelDb);
/** perform necessary initialization to use a clone context, namely caching the reference types in the source's schemas */
initialize(): Promise<void>;
/** construct and initialize an IModelElementCloneContext at once, for where you construct in an async context */
static create(...args: ConstructorParameters<typeof IModelElementCloneContext>): Promise<IModelElementCloneContext>;
/** Returns `true` if this context is for transforming between 2 iModels and `false` if it for transforming within the same iModel. */
get isBetweenIModels(): boolean;
/** Dispose any native resources associated with this IModelElementCloneContext. */
[Symbol.dispose](): void;
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
dispose(): void;
/** Debugging aid that dumps the Id remapping details and other information to the specified output file.
* @internal
*/
dump(outputFileName: string): void;
/** Add a rule that remaps the specified source [CodeSpec]($common) to the specified target [CodeSpec]($common).
* @param sourceCodeSpecName The name of the CodeSpec from the source iModel.
* @param targetCodeSpecName The name of the CodeSpec from the target iModel.
* @throws [[IModelError]] if either CodeSpec could not be found.
*/
remapCodeSpec(sourceCodeSpecName: string, targetCodeSpecName: string): void;
/** Add a rule that remaps the specified source class to the specified target class. */
remapElementClass(sourceClassFullName: string, targetClassFullName: string): void;
/** Add a rule that remaps the specified source Element to the specified target Element. */
remapElement(sourceId: Id64String, targetId: Id64String): void;
/** Remove a rule that remaps the specified source Element. */
removeElement(sourceId: Id64String): void;
/** Look up a target CodeSpecId from the source CodeSpecId.
* @returns the target CodeSpecId or [Id64.invalid]($bentley) if a mapping not found.
*/
findTargetCodeSpecId(sourceId: Id64String): Id64String;
/** Look up a target ElementId from the source ElementId.
* @returns the target ElementId or [Id64.invalid]($bentley) if a mapping not found.
*/
findTargetElementId(sourceElementId: Id64String): Id64String;
/** Filter out geometry entries in the specified SubCategory from GeometryStreams in the target iModel.
* @note It is not possible to filter out a *default* SubCategory. A request to do so will be ignored.
* @see [SubCategory.isDefaultSubCategory]($backend)
*/
filterSubCategory(sourceSubCategoryId: Id64String): void;
/** Returns `true` if there are any SubCategories being filtered. */
get hasSubCategoryFilter(): boolean;
/** Returns `true` if this SubCategory is being filtered. */
isSubCategoryFiltered(subCategoryId: Id64String): boolean;
/** Import the specified font from the source iModel into the target iModel.
* @internal
*/
importFont(sourceFontNumber: number): void;
/** Import a single CodeSpec from the source iModel into the target iModel.
* @internal
*/
importCodeSpec(sourceCodeSpecId: Id64String): void;
/** Clone the specified source Element into ElementProps for the target iModel.
* @internal
*/
cloneElement(sourceElement: Element, cloneOptions?: IModelJsNative.CloneElementOptions): ElementProps;
/**
* serialize state to a sqlite database at a given path
* assumes the database has not already had any context state serialized to it
* @internal
*/
saveStateToDb(db: SQLiteDb): void;
/**
* load state from a sqlite database at a given path
* @internal
*/
loadStateFromDb(db: SQLiteDb): void;
}
//# sourceMappingURL=IModelElementCloneContext.d.ts.map