/** @packageDocumentation * @module iModels */ import { BeEvent, GuidString, Id64String, OpenMode } from "@bentley/bentleyjs-core"; import { Angle, Point3d, Range3dProps, Transform, Vector3d, XYAndZ, XYZProps, YawPitchRollAngles, YawPitchRollProps } from "@bentley/geometry-core"; import { ChangesetId, ChangesetIdWithIndex, ChangesetIndex } from "./ChangesetProps"; import { Cartographic, LatLongAndHeight } from "./geometry/Cartographic"; import { GeographicCRS, GeographicCRSProps } from "./geometry/CoordinateReferenceSystem"; import { AxisAlignedBox3d } from "./geometry/Placement"; import { ThumbnailProps } from "./Thumbnail"; /** The properties to open a connection to an iModel for RPC operations. * @public */ export interface IModelRpcOpenProps { /** The context (Project, Asset, or other infrastructure) in which the iModel exists - must be defined for briefcases that are synchronized with iModelHub. */ readonly contextId?: GuidString; /** Guid of the iModel. */ readonly iModelId?: GuidString; /** Id of the last ChangeSet that was applied to the iModel - must be defined for briefcases that are synchronized with iModelHub. An empty string indicates the first version. * @note ChangeSet Ids are string hash values based on the ChangeSet's content and parent. */ changeSetId?: ChangesetId; /** The index of the last changeset. If <= 0, must be determined by changeSetId */ changesetIndex?: ChangesetIndex; /** Mode used to open the iModel */ openMode?: OpenMode; } /** The properties that identify an opened iModel for RPC operations. * @public */ export interface IModelRpcProps extends IModelRpcOpenProps { /** Unique key used for identifying the iModel between the frontend and the backend */ readonly key: string; } /** Properties that position an iModel on the earth via [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates * @public */ export interface EcefLocationProps { /** The Origin of an iModel on the earth in ECEF coordinates */ origin: XYZProps; /** The [orientation](https://en.wikipedia.org/wiki/Geographic_coordinate_conversion) of an iModel on the earth. */ orientation: YawPitchRollProps; /** Optional position on the earth used to establish the ECEF coordinates. */ cartographicOrigin?: LatLongAndHeight; /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */ xVector?: XYZProps; /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */ yVector?: XYZProps; } /** Properties of the [Root Subject]($docs/bis/intro/glossary#subject-root). * @public */ export interface RootSubjectProps { /** The name of the root subject. */ name: string; /** Description of the root subject (optional). */ description?: string; } /** Properties of an iModel that are always held in memory whenever one is opened, both on the frontend and on the backend . * @public */ export interface IModelProps { /** The name and description of the root subject of this iModel */ rootSubject: RootSubjectProps; /** The volume of the entire project, in spatial coordinates */ projectExtents?: Range3dProps; /** An offset to be applied to all spatial coordinates. This is normally used to transform spatial coordinates into the Cartesian coordinate system of a Geographic Coordinate System. */ globalOrigin?: XYZProps; /** The location of the iModel in Earth Centered Earth Fixed coordinates. iModel units are always meters */ ecefLocation?: EcefLocationProps; /** The Geographic Coordinate Reference System indicating the projection and datum used. */ geographicCoordinateSystem?: GeographicCRSProps; /** The name of the iModel. */ name?: string; } /** The properties returned by the backend when creating a new [[IModelConnection]] from the frontend, either with Rpc or with Ipc. * These properties describe the iModel held on the backend for thew newly formed connection and are used to construct a new * [[IModelConnection]] instance on the frontend to access it. * @public */ export declare type IModelConnectionProps = IModelProps & IModelRpcProps; /** The properties that can be supplied when creating a *new* iModel. * @public */ export interface CreateIModelProps extends IModelProps { /** The GUID of new iModel. If not present, a GUID will be generated. */ guid?: GuidString; /** Client name for new iModel */ client?: string; /** Thumbnail for new iModel * @alpha */ thumbnail?: ThumbnailProps; } /** Encryption-related properties that can be supplied when creating or opening snapshot iModels. * @public */ export interface IModelEncryptionProps { /** The password used to encrypt/decrypt the snapshot iModel. */ password?: string; } /** * A key used to identify an opened [IModelDb]($backend) between the frontend and backend for Rpc and Ipc communications. * Keys must be unique - that is there can never be two IModelDbs opened with the same key at any given time. * If no key is supplied in a call to open an IModelDb, one is generated and returned. * It is only necessary to supply a key if you have some reason to assign a specific value to identify an IModelDb. * If you don't supply the key, you must use the returned value for Rpc and Ipc communications. * @public */ export interface OpenDbKey { key?: string; } /** Options to open a [SnapshotDb]($backend). * @public */ export interface SnapshotOpenOptions extends IModelEncryptionProps, OpenDbKey { /** @internal */ lazyBlockCache?: boolean; /** @internal */ autoUploadBlocks?: boolean; } /** Options to open a [StandaloneDb]($backend) via [StandaloneDb.openFile]($backend) from the backend, * or [BriefcaseConnection.openStandalone]($frontend) from the frontend. * @public */ export declare type StandaloneOpenOptions = OpenDbKey; /** Options that can be supplied when creating snapshot iModels. * @public */ export interface CreateSnapshotIModelProps extends IModelEncryptionProps { /** If true, then create SQLite views for Model, Element, ElementAspect, and Relationship classes. * These database views can often be useful for interoperability workflows. */ createClassViews?: boolean; } /** The options that can be specified when creating an *empty* snapshot iModel. * @see [SnapshotDb.createEmpty]($backend) * @public */ export declare type CreateEmptySnapshotIModelProps = CreateIModelProps & CreateSnapshotIModelProps; /** Options that can be supplied when creating standalone iModels. * @internal */ export interface CreateStandaloneIModelProps extends IModelEncryptionProps { /** If present, file will allow local editing, but cannot be used to create changesets */ allowEdit?: string; } /** The options that can be specified when creating an *empty* standalone iModel. * @see [standalone.createEmpty]($backend) * @internal */ export declare type CreateEmptyStandaloneIModelProps = CreateIModelProps & CreateStandaloneIModelProps; /** @public */ export interface FilePropertyProps { namespace: string; name: string; id?: number | string; subId?: number | string; } /** The position and orientation of an iModel on the earth in [ECEF](https://en.wikipedia.org/wiki/ECEF) (Earth Centered Earth Fixed) coordinates * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md) * @public */ export declare class EcefLocation implements EcefLocationProps { /** The origin of the ECEF transform. */ readonly origin: Point3d; /** The orientation of the ECEF transform */ readonly orientation: YawPitchRollAngles; /** Optional position on the earth used to establish the ECEF origin and orientation. */ readonly cartographicOrigin?: Cartographic; /** Optional X column vector used with [[yVector]] to calculate potentially non-rigid transform if a projection is present. */ readonly xVector?: Vector3d; /** Optional Y column vector used with [[xVector]] to calculate potentially non-rigid transform if a projection is present. */ readonly yVector?: Vector3d; private _transform; /** Get the transform from iModel Spatial coordinates to ECEF from this EcefLocation */ getTransform(): Transform; /** Construct a new EcefLocation. Once constructed, it is frozen and cannot be modified. */ constructor(props: EcefLocationProps); /** Construct ECEF Location from cartographic origin with optional known point and angle. */ static createFromCartographicOrigin(origin: Cartographic, point?: Point3d, angle?: Angle): EcefLocation; /** Get the location center of the earth in the iModel coordinate system. */ get earthCenter(): Point3d; /** Return true if this location is equivalent to another location within a small tolerance. */ isAlmostEqual(other: EcefLocation): boolean; toJSON(): EcefLocationProps; } /** Represents an iModel in JavaScript. * @see [GeoLocation of iModels]($docs/learning/GeoLocation.md) * @public */ export declare abstract class IModel implements IModelProps { private _projectExtents?; private _name?; private _rootSubject?; private _globalOrigin?; private _ecefLocation?; private _ecefTrans?; private _geographicCoordinateSystem?; private _iModelId?; /** The Id of the repository model. */ static readonly repositoryModelId: Id64String; /** The Id of the root subject element. */ static readonly rootSubjectId: Id64String; /** The Id of the dictionary model. */ static readonly dictionaryId: Id64String; /** Event raised after [[name]] changes. */ readonly onNameChanged: BeEvent<(previousName: string) => void>; /** Event raised after [[rootSubject]] changes. */ readonly onRootSubjectChanged: BeEvent<(previousSubject: RootSubjectProps) => void>; /** Event raised after [[projectExtents]] changes. */ readonly onProjectExtentsChanged: BeEvent<(previousExtents: AxisAlignedBox3d) => void>; /** Event raised after [[globalOrigin]] changes. */ readonly onGlobalOriginChanged: BeEvent<(previousOrigin: Point3d) => void>; /** Event raised after [[ecefLocation]] changes. */ readonly onEcefLocationChanged: BeEvent<(previousLocation: EcefLocation | undefined) => void>; /** Event raised after [[geographicCoordinateSystem]] changes. */ readonly onGeographicCoordinateSystemChanged: BeEvent<(previousGCS: GeographicCRS | undefined) => void>; /** Name of the iModel */ get name(): string; set name(name: string); /** The name and description of the root subject of this iModel */ get rootSubject(): RootSubjectProps; set rootSubject(subject: RootSubjectProps); /** Returns `true` if this is a snapshot iModel. */ abstract get isSnapshot(): boolean; /** Returns `true` if this is a briefcase copy of an iModel that is synchronized with iModelHub. */ abstract get isBriefcase(): boolean; abstract get isOpen(): boolean; /** * The volume, in spatial coordinates, inside which the entire project is contained. * @note The object returned from this method is frozen. You *must* make a copy before you do anything that might attempt to modify it. */ get projectExtents(): AxisAlignedBox3d; set projectExtents(extents: AxisAlignedBox3d); /** An offset to be applied to all spatial coordinates. */ get globalOrigin(): Point3d; set globalOrigin(org: Point3d); /** The [EcefLocation]($docs/learning/glossary#ecefLocation) of the iModel in Earth Centered Earth Fixed coordinates. */ get ecefLocation(): EcefLocation | undefined; set ecefLocation(ecefLocation: EcefLocation | undefined); /** Set the [EcefLocation]($docs/learning/glossary#ecefLocation) for this iModel. */ setEcefLocation(ecef: EcefLocationProps): void; /** The geographic coordinate reference system of the iModel. */ get geographicCoordinateSystem(): GeographicCRS | undefined; set geographicCoordinateSystem(geoCRS: GeographicCRS | undefined); /** Sets the geographic coordinate reference system from GeographicCRSProps. */ setGeographicCoordinateSystem(geoCRS: GeographicCRSProps): void; /** @internal */ getConnectionProps(): IModelConnectionProps; /** @internal */ toJSON(): IModelConnectionProps; /** A key used to identify this iModel in RPC calls from frontend to backend. * @internal */ protected _fileKey: string; /** Get the key that was used to open this iModel. This is the value used for Rpc and Ipc communications. */ get key(): string; /** @internal */ protected _contextId?: GuidString; /** The Guid that identifies the *context* that owns this iModel. */ get contextId(): GuidString | undefined; /** The Guid that identifies this iModel. */ get iModelId(): GuidString | undefined; /** @public */ changeset: ChangesetIdWithIndex; /** The Id of the last changeset that was applied to this iModel. * @note An empty string indicates the first version * @deprecated use changeset.id */ get changeSetId(): string; /** The [[OpenMode]] used for this IModel. */ readonly openMode: OpenMode; /** Return a token for RPC operations. */ getRpcProps(): IModelRpcProps; /** @internal */ protected constructor(tokenProps: IModelRpcProps | undefined, openMode: OpenMode); /** @internal */ protected initialize(name: string, props: IModelProps): void; /** Get the default subCategoryId for the supplied categoryId */ static getDefaultSubCategoryId(categoryId: Id64String): Id64String; /** True if this iModel has an [EcefLocation]($docs/learning/glossary#ecefLocation). */ get isGeoLocated(): boolean; /** Get the Transform from this iModel's Spatial coordinates to ECEF coordinates using its [[IModel.ecefLocation]]. * @throws IModelError if [[isGeoLocated]] is false. */ getEcefTransform(): Transform; /** Convert a point in this iModel's Spatial coordinates to an ECEF point using its [[IModel.ecefLocation]]. * @param spatial A point in the iModel's spatial coordinates * @param result If defined, use this for output * @returns A Point3d in ECEF coordinates * @throws IModelError if [[isGeoLocated]] is false. */ spatialToEcef(spatial: XYAndZ, result?: Point3d): Point3d; /** Convert a point in ECEF coordinates to a point in this iModel's Spatial coordinates using its [[ecefLocation]]. * @param ecef A point in ECEF coordinates * @param result If defined, use this for output * @returns A Point3d in this iModel's spatial coordinates * @throws IModelError if [[isGeoLocated]] is false. * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel. */ ecefToSpatial(ecef: XYAndZ, result?: Point3d): Point3d; /** Convert a point in this iModel's Spatial coordinates to a [[Cartographic]] using its [[IModel.ecefLocation]]. * @param spatial A point in the iModel's spatial coordinates * @param result If defined, use this for output * @returns A Cartographic location * @throws IModelError if [[isGeoLocated]] is false. */ spatialToCartographicFromEcef(spatial: XYAndZ, result?: Cartographic): Cartographic; /** Convert a [[Cartographic]] to a point in this iModel's Spatial coordinates using its [[IModel.ecefLocation]]. * @param cartographic A cartographic location * @param result If defined, use this for output * @returns A point in this iModel's spatial coordinates * @throws IModelError if [[isGeoLocated]] is false. * @note The resultant point will only be meaningful if the ECEF coordinate is close on the earth to the iModel. */ cartographicToSpatialFromEcef(cartographic: Cartographic, result?: Point3d): Point3d; } //# sourceMappingURL=IModel.d.ts.map