@itwin/core-backend
Version:
iTwin.js backend components
944 lines • 59.2 kB
TypeScript
/** @packageDocumentation
* @module Elements
*/
import { GuidString, Id64String } from "@itwin/core-bentley";
import { AxisAlignedBox3d, Code, CodeScopeProps, ConcreteEntityTypes, DefinitionElementProps, DrawingProps, ElementAlignedBox3d, ElementProps, EntityMetaData, EntityReferenceSet, GeometricElement2dProps, GeometricElement3dProps, GeometricElementProps, GeometryPartProps, GeometryStreamProps, InformationPartitionElementProps, LineStyleProps, ModelProps, PhysicalElementProps, PhysicalTypeProps, Placement2d, Placement3d, RelatedElement, RenderSchedule, RenderTimelineProps, RepositoryLinkProps, SectionDrawingLocationProps, SectionDrawingProps, SectionType, SheetBorderTemplateProps, SheetProps, SheetTemplateProps, SubjectProps, TypeDefinition, TypeDefinitionElementProps, UrlLinkProps } from "@itwin/core-common";
import { ClipVector, Transform } from "@itwin/core-geometry";
import { CustomHandledProperty, DeserializeEntityArgs, ECSqlRow, Entity } from "./Entity";
import { IModelDb } from "./IModelDb";
import { IModelElementCloneContext } from "./IModelElementCloneContext";
import { EntityClass } from "@itwin/ecschema-metadata";
/** Argument for the `Element.onXxx` static methods
* @beta
*/
export interface OnElementArg {
/** The iModel for the Element affected by this method. */
iModel: IModelDb;
}
/** Argument for `Element.onInsert` and `Element.onUpdate` static methods.
* @beta
*/
export interface OnElementPropsArg extends OnElementArg {
/** The properties of the Element affected by this method.
* @note the properties may be modified. If so the modified values will be inserted/updated.
*/
props: ElementProps;
}
/** Argument for the `Element.onXxx` static methods that notify of operations to an existing Element supplying its Id, ModelId and FederationGuid.
* @beta
*/
export interface OnElementIdArg extends OnElementArg {
/** The Id of the Element affected by this method */
id: Id64String;
/** The ModelId of the element affected by this method */
model: Id64String;
/** The federationGuid of the element affected by this method */
federationGuid: GuidString;
}
/** Argument for the `Element.onChildXxx` static methods
* @beta
*/
export interface OnChildElementArg extends OnElementArg {
parentId: Id64String;
}
/** Argument for the `Element.onChildXxx` static methods that supply the properties of the child Element to be inserted or updated.
* @beta
*/
export interface OnChildElementPropsArg extends OnChildElementArg {
/** The new properties of the child Element for this method. */
childProps: Readonly<ElementProps>;
}
/** Argument for the `Element.onChildXxx` static methods that only supply the Id of the child Element.
* @beta
*/
export interface OnChildElementIdArg extends OnChildElementArg {
/** The Id of the child element for this method */
childId: Id64String;
}
/** Argument for the `Element.onSubModelInsert` static method
* @beta
*/
export interface OnSubModelPropsArg extends OnElementArg {
/** The properties of the prospective sub-model */
subModelProps: ModelProps;
}
/** Argument for several `Element.onSubModelXxx` static methods
* @beta
*/
export interface OnSubModelIdArg extends OnElementArg {
/** The modelId of the sub Model */
subModelId: Id64String;
}
/** The smallest individually identifiable building block for modeling the real world in an iModel.
* Each element represents an [[Entity]] in the real world. Sets of Elements (contained in [[Model]]s) are used to model
* other Elements that represent larger scale real world entities. Using this recursive modeling strategy,
* Elements can represent entities at any scale. Elements can represent physical things or abstract concepts
* or simply be information records.
*
* Every Element has a 64-bit id (inherited from Entity) that uniquely identifies it within an iModel. Every Element also
* has a [[code]] that identifies its meaning in the real world. Additionally, Elements may have a [[federationGuid]]
* to hold a GUID, if the element was assigned that GUID by some other federated database. The iModel database enforces
* uniqueness of id, code, and federationGuid.
*
* The Element class provides `static` methods like [[onInsert]], [[onUpdated]], [[onCloned]], and [[onChildAdded]] that enable
* it to customize persistence operations. For example, the base implementations of [[onInsert]], [[onUpdate]], and [[onDelete]]
* validate that the appropriate [locks]($docs/learning/backend/ConcurrencyControl.md), [codes]($docs/learning/backend/CodeService.md),
* and [channel permissions]($docs/learning/backend/Channel.md) are obtained before a change to the element is written to the iModel.
* A subclass of Element that overrides any of these methods **must** call the `super` method as well. An application that supplies its
* own Element subclasses should register them at startup via [[ClassRegistry.registerModule]] or [[ClassRegistry.register]].
*
* See:
* * [Element Fundamentals]($docs/bis/guide/fundamentals/element-fundamentals.md)
* * [Working with schemas and elements in TypeScript]($docs/learning/backend/SchemasAndElementsInTypeScript.md)
* * [Creating elements]($docs/learning/backend/CreateElements.md)
* @public @preview
*/
export declare class Element extends Entity {
static get className(): string;
/** @internal */
static get protectedOperations(): string[];
/** The ModelId of the [Model]($docs/bis/guide/fundamentals/model-fundamentals.md) containing this element */
readonly model: Id64String;
/** The [Code]($docs/bis/guide/fundamentals/codes.md) for this element */
code: Code;
/** The parent element, if present, of this element. */
parent?: RelatedElement;
/** A [FederationGuid]($docs/bis/guide/fundamentals/element-fundamentals.md#federationguid) assigned to this element by some other federated database */
federationGuid?: GuidString;
/** A [user-assigned label]($docs/bis/guide/fundamentals/element-fundamentals.md#userlabel) for this element. */
userLabel?: string;
/** Optional [json properties]($docs/bis/guide/fundamentals/element-fundamentals.md#jsonproperties) of this element. */
readonly jsonProperties: {
[key: string]: any;
};
protected constructor(props: ElementProps, iModel: IModelDb);
/**
* Element custom HandledProps include 'codeValue', 'codeSpec', 'codeScope', 'model', 'parent', 'federationGuid', and 'lastMod'.
* @inheritdoc
* @beta
*/
protected static readonly _customHandledProps: CustomHandledProperty[];
/**
* Element deserializes 'codeValue', 'codeSpec', 'codeScope', 'model', 'parent', and 'federationGuid'.
* @inheritdoc
* @beta
*/
static deserialize(props: DeserializeEntityArgs): ElementProps;
/**
* Element serialize 'codeValue', 'codeSpec', 'codeScope', 'model', 'parent', and 'federationGuid'.
* @inheritdoc
* @beta
*/
static serialize(props: ElementProps, iModel: IModelDb): ECSqlRow;
/** Called before a new Element is inserted.
* @note throw an exception to disallow the insert
* @note If you override this method, you must call super.
* @note `this` is the class of the Element to be inserted
* @beta
*/
protected static onInsert(arg: OnElementPropsArg): void;
/** Called after a new Element was inserted.
* @note If you override this method, you must call super.
* @note `this` is the class of the Element that was inserted
* @beta
*/
protected static onInserted(arg: OnElementIdArg): void;
/** Called before an Element is updated.
* @note throw an exception to disallow the update
* @note If you override this method, you must call super.
* @note `this` is the class of the Element to be updated
* @beta
*/
protected static onUpdate(arg: OnElementPropsArg): void;
/** Called after an Element was updated.
* @note If you override this method, you must call super.
* @note `this` is the class of the Element that was updated
* @beta
*/
protected static onUpdated(arg: OnElementIdArg): void;
/** Called before an Element is deleted.
* @note throw an exception to disallow the delete
* @note If you override this method, you must call super.
* @note `this` is the class of the Element to be deleted
* @beta
*/
protected static onDelete(arg: OnElementIdArg): void;
/** Called after an Element was deleted.
* @note If you override this method, you must call super.
* @note `this` is the class of the Element that was deleted
* @beta
*/
protected static onDeleted(arg: OnElementIdArg): void;
/** Called when an element with an instance of this class as its parent is about to be deleted.
* @note throw an exception if the element should not be deleted
* @note implementers should not presume that the element was deleted if this method does not throw,
* since the delete may fail for other reasons. Instead, rely on [[onChildDeleted]] for that purpose.
* @note `this` is the class of the parent Element whose child will be deleted
* @beta
*/
protected static onChildDelete(_arg: OnChildElementIdArg): void;
/** Called after an element with an instance of this class as its parent was successfully deleted.
* @note `this` is the class of the parent Element whose child was deleted
* @beta
*/
protected static onChildDeleted(arg: OnChildElementIdArg): void;
/** Called when a *new element* with an instance of this class as its parent is about to be inserted.
* @note throw an exception if the element should not be inserted
* @note `this` is the class of the prospective parent Element.
* @beta
*/
protected static onChildInsert(_arg: OnChildElementPropsArg): void;
/** Called after a *new element* with an instance of this class as its parent was inserted.
* @note `this` is the class of the parent Element.
* @beta
*/
protected static onChildInserted(arg: OnChildElementIdArg): void;
/** Called when an element with an instance of this class as its parent is about to be updated.
* @note throw an exception if the element should not be updated
* @note `this` is the class of the parent Element.
* @beta
*/
protected static onChildUpdate(_arg: OnChildElementPropsArg): void;
/** Called after an element with an instance of this the class as its parent was updated.
* @note `this` is the class of the parent Element.
* @beta
*/
protected static onChildUpdated(arg: OnChildElementIdArg): void;
/** Called when an *existing element* is about to be updated so that an instance of this class will become its new parent.
* @note throw an exception if the element should not be added
* @note `this` is the class of the prospective parent Element.
* @beta
*/
protected static onChildAdd(_arg: OnChildElementPropsArg): void;
/** Called after an *existing element* has been updated so that an instance of this class is its new parent.
* @note `this` is the class of the new parent Element.
* @beta
*/
protected static onChildAdded(arg: OnChildElementIdArg): void;
/** Called when an element with an instance of this class as its parent is about to be updated change to a different parent.
* @note throw an exception if the element should not be dropped
* @note `this` is the class of the parent Element.
* @beta
*/
protected static onChildDrop(_arg: OnChildElementIdArg): void;
/** Called after an element with an instance of this class as its previous parent was updated to have a new parent.
* @note `this` is the class of the previous parent Element.
* @beta
*/
protected static onChildDropped(arg: OnChildElementIdArg): void;
/** Called when an instance of this class is being *sub-modeled* by a new Model.
* @note throw an exception if model should not be inserted
* @note `this` is the class of Element to be sub-modeled.
* @beta
*/
protected static onSubModelInsert(_arg: OnSubModelPropsArg): void;
/** Called after an instance of this class was *sub-modeled* by a new Model.
* @note `this` is the class of Element that is now sub-modeled.
* @beta
*/
protected static onSubModelInserted(arg: OnSubModelIdArg): void;
/** Called when a sub-model of an instance of this class is being deleted.
* @note throw an exception if model should not be deleted
* @note `this` is the class of Element that is sub-modeled.
* @beta
*/
protected static onSubModelDelete(_arg: OnSubModelIdArg): void;
/** Called after a sub-model of an instance of this class was deleted.
* @note `this` is the class of Element that was sub-modeled.
* @beta
*/
protected static onSubModelDeleted(arg: OnSubModelIdArg): void;
/** Called during the iModel transformation process after an Element from the source iModel was *cloned* for the target iModel.
* The transformation process automatically handles remapping BisCore properties and those that are properly described in ECSchema.
* This callback is only meant to be overridden if there are other Ids in non-standard locations that need to be remapped or other data that needs to be fixed up after the clone.
* @param _context The context that persists any remapping between the source iModel and target iModel.
* @param _sourceProps The ElementProps for the source Element that was cloned.
* @param _targetProps The ElementProps that are a result of the clone. These can be further modified.
* @note If you override this method, you must call super.
* @beta
*/
protected static onCloned(_context: IModelElementCloneContext, _sourceProps: ElementProps, _targetProps: ElementProps): void;
/** Called when a *root* element in a subgraph is changed and before its outputs are processed.
* This special callback is made when:
* * the element is part of an [[ElementDrivesElement]] graph, and
* * the element has no inputs, and
* * none of the element's outputs have been processed.
* @see [[ElementDrivesElement]] for more on element dependency graphs.
* @beta
*/
protected static onBeforeOutputsHandled(_id: Id64String, _iModel: IModelDb): void;
/** Called on an element in a graph after all of its inputs have been processed and before its outputs are processed.
* This callback is made when:
* * the specified element is part of an [[ElementDrivesElement]] graph, and
* * there was a direct change to some element upstream in the dependency graph.
* * all upstream elements in the graph have been processed.
* * none of the downstream elements have been processed.
* This method is not called if none of the element's inputs were changed.
* @see [[ElementDrivesElement]] for more on element dependency graphs.
* @beta
*/
protected static onAllInputsHandled(_id: Id64String, _iModel: IModelDb): void;
toJSON(): ElementProps;
protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
/** A *required reference* is an element that had to be inserted before this element could have been inserted.
* This is the list of property keys on this element that store references to those elements
* @note This should be overridden (with `super` called) at each level of the class hierarchy that introduces required references.
* @note any property listed here must be added to the reference ids in [[collectReferenceIds]]
* @beta
*/
static readonly requiredReferenceKeys: ReadonlyArray<string>;
/** A map of every [[requiredReferenceKeys]] on this class to their entity type.
* @note This should be overridden (with `super` called) at each level of the class hierarchy that introduces required references.
* @alpha
*/
static readonly requiredReferenceKeyTypeMap: Record<string, ConcreteEntityTypes>;
/** Get the class metadata for this element.
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Please use `getMetaData` provided by the parent class `Entity` instead.
*
* @example
* ```typescript
* // Current usage:
* const metaData: EntityMetaData | undefined = element.getClassMetaData();
*
* // Replacement:
* const metaData: EntityClass = await element.getMetaData();
* ```
*/
getClassMetaData(): EntityMetaData | undefined;
/** Query metadata for this entity class from the iModel's schema. Returns cached metadata if available.*/
getMetaData(): Promise<EntityClass>;
private getAllUserProperties;
/** Get a set of JSON user properties by namespace */
getUserProperties(namespace: string): any;
/** Change a set of user JSON properties of this Element by namespace. */
setUserProperties(nameSpace: string, value: any): void;
/** Remove a set of JSON user properties, specified by namespace, from this Element */
removeUserProperties(nameSpace: string): void;
/** Get a JSON property of this element, by namespace */
getJsonProperty(nameSpace: string): any;
setJsonProperty(nameSpace: string, value: any): void;
/** Get a display label for this Element. By default returns userLabel if present, otherwise code value. */
getDisplayLabel(): string;
/** Get a list of HTML strings that describe this Element for the tooltip. Strings will be listed on separate lines in the tooltip.
* Any instances of the pattern `%{tag}` will be replaced by the localized value of tag.
*/
getToolTipMessage(): string[];
/**
* Insert this Element into the iModel.
* @see [[IModelDb.Elements.insertElement]]
* @note For convenience, the value of `this.id` is updated to reflect the resultant element's id.
* However when `this.federationGuid` is not present or undefined, a new Guid will be generated and stored on the resultant element. But
* the value of `this.federationGuid` is *not* updated. Generally, it is best to re-read the element after inserting (e.g. via [[IModelDb.Elements.getElement]])
* if you intend to continue working with it. That will ensure its values reflect the persistent state.
*/
insert(): string;
/** Update this Element in the iModel. */
update(): void;
/** Delete this Element from the iModel. */
delete(): void;
}
/** An abstract base class to model real world entities that intrinsically have geometry.
* @public @preview
*/
export declare abstract class GeometricElement extends Element {
static get className(): string;
/** The Id of the [[Category]] for this GeometricElement. */
category: Id64String;
/** The GeometryStream for this GeometricElement. */
geom?: GeometryStreamProps;
/** The origin, orientation, and bounding box of this GeometricElement. */
abstract get placement(): Placement2d | Placement3d;
protected constructor(props: GeometricElementProps, iModel: IModelDb);
/** Type guard for instanceof [[GeometricElement3d]] */
is3d(): this is GeometricElement3d;
/** Type guard for instanceof [[GeometricElement2d]] */
is2d(): this is GeometricElement2d;
/** Get the [Transform]($geometry) from the Placement of this GeometricElement */
getPlacementTransform(): Transform;
calculateRange3d(): AxisAlignedBox3d;
toJSON(): GeometricElementProps;
protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
/** @beta */
static readonly requiredReferenceKeys: ReadonlyArray<string>;
/** @alpha */
static readonly requiredReferenceKeyTypeMap: Record<string, ConcreteEntityTypes>;
/**
* GeometricElement custom HandledProps includes 'inSpatialIndex'.
* @inheritdoc
* @beta
*/
protected static readonly _customHandledProps: CustomHandledProperty[];
/**
* GeometricElement deserializes 'inSpatialIndex'.
* @inheritdoc
* @beta
*/
static deserialize(props: DeserializeEntityArgs): GeometricElementProps;
/**
* GeometricElement serialize 'inSpatialIndex'.
* @inheritdoc
* @beta
*/
static serialize(props: GeometricElementProps, iModel: IModelDb): ECSqlRow;
}
/** An abstract base class to model real world entities that intrinsically have 3d geometry.
* See [how to create a GeometricElement3d]($docs/learning/backend/CreateElements.md#GeometricElement3d).
* @public @preview
*/
export declare abstract class GeometricElement3d extends GeometricElement {
static get className(): string;
placement: Placement3d;
typeDefinition?: TypeDefinition;
protected constructor(props: GeometricElement3dProps, iModel: IModelDb);
toJSON(): GeometricElement3dProps;
protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
/**
* GeometricElement3d custom HandledProps includes 'category', 'geometryStream', 'origin', 'yaw', 'pitch', 'roll',
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
* @inheritdoc
* @beta
*/
protected static readonly _customHandledProps: CustomHandledProperty[];
/**
* GeometricElement3d deserializes 'category', 'geometryStream', 'origin', 'yaw', 'pitch', 'roll',
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
* @inheritdoc
* @beta
*/
static deserialize(props: DeserializeEntityArgs): GeometricElement3dProps;
/**
* GeometricElement3d serializes 'category', 'geometryStream', 'origin', 'yaw', 'pitch', 'roll',
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
* @inheritdoc
* @beta
*/
static serialize(props: GeometricElement3dProps, iModel: IModelDb): ECSqlRow;
}
/** A 3d Graphical Element
* @public @preview
*/
export declare abstract class GraphicalElement3d extends GeometricElement3d {
static get className(): string;
protected constructor(props: GeometricElement3dProps, iModel: IModelDb);
}
/** An abstract base class to model information entities that intrinsically have 2d geometry.
* @public @preview
*/
export declare abstract class GeometricElement2d extends GeometricElement {
static get className(): string;
placement: Placement2d;
typeDefinition?: TypeDefinition;
protected constructor(props: GeometricElement2dProps, iModel: IModelDb);
toJSON(): GeometricElement2dProps;
/**
* GeometricElement2d custom HandledProps includes 'category', 'geometryStream', 'origin', 'rotation',
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
* @inheritdoc
* @beta
*/
protected static readonly _customHandledProps: CustomHandledProperty[];
/**
* GeometricElement2d deserialize 'category', 'geometryStream', 'origin', 'rotation',
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
* @inheritdoc
* @beta
*/
static deserialize(props: DeserializeEntityArgs): GeometricElement2dProps;
/**
* GeometricElement2d serializes 'category', 'geometryStream', 'origin', 'rotation',
* 'bBoxLow', 'bBoxHigh', and 'typeDefinition'.
* @inheritdoc
* @beta
*/
static serialize(props: GeometricElement2dProps, iModel: IModelDb): ECSqlRow;
protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
}
/** An abstract base class for 2d Geometric Elements that are used to convey information within graphical presentations (like drawings).
* @public @preview
*/
export declare abstract class GraphicalElement2d extends GeometricElement2d {
static get className(): string;
protected constructor(props: GeometricElement2dProps, iModel: IModelDb);
}
/** 2d element used to annotate drawings and sheets.
* @public @preview
*/
export declare class AnnotationElement2d extends GraphicalElement2d {
static get className(): string;
protected constructor(props: GeometricElement2dProps, iModel: IModelDb);
}
/** 2d element used to persist graphics for use in drawings.
* @public @preview
*/
export declare class DrawingGraphic extends GraphicalElement2d {
static get className(): string;
protected constructor(props: GeometricElement2dProps, iModel: IModelDb);
}
/** An Element that occupies real world space. Its coordinates are in the project space of its iModel.
* @public @preview
*/
export declare abstract class SpatialElement extends GeometricElement3d {
static get className(): string;
protected constructor(props: GeometricElement3dProps, iModel: IModelDb);
}
/** An Element that is spatially located, has mass, and can be *touched*.
* @public @preview
*/
export declare abstract class PhysicalElement extends SpatialElement {
static get className(): string;
/** If defined, the [[PhysicalMaterial]] that makes up this PhysicalElement. */
physicalMaterial?: RelatedElement;
protected constructor(props: PhysicalElementProps, iModel: IModelDb);
toJSON(): PhysicalElementProps;
}
/** Identifies a *tracked* real world location but has no mass and cannot be *touched*.
* @public @preview
*/
export declare abstract class SpatialLocationElement extends SpatialElement {
static get className(): string;
protected constructor(props: GeometricElement3dProps, iModel: IModelDb);
}
/** A Volume Element is a Spatial Location Element that is restricted to defining a volume.
* @public @preview
*/
export declare class VolumeElement extends SpatialLocationElement {
static get className(): string;
protected constructor(props: GeometricElement3dProps, iModel: IModelDb);
}
/** A SectionDrawingLocation element identifies the location of a [[SectionDrawing]] in the context of a [[SpatialModel]],
* enabling [HyperModeling]($hypermodeling).
* @note The associated ECClass was added to the BisCore schema in version 1.0.11.
* @public @preview
*/
export declare class SectionDrawingLocation extends SpatialLocationElement {
/** The Id of the [[ViewDefinition]] to which this location refers. */
sectionView: RelatedElement;
static get className(): string;
constructor(props: SectionDrawingLocationProps, iModel: IModelDb);
toJSON(): SectionDrawingLocationProps;
}
/** Information Content Element is an abstract base class for modeling pure information entities. Only the
* core framework should directly subclass from Information Content Element. Domain and application developers
* should start with the most appropriate subclass of Information Content Element.
* @public @preview
*/
export declare abstract class InformationContentElement extends Element {
static get className(): string;
protected constructor(props: ElementProps, iModel: IModelDb);
}
/** Element used in conjunction with bis:ElementDrivesElement relationships to bundle multiple inputs before
* driving the output element.
* @beta
*/
export declare abstract class DriverBundleElement extends InformationContentElement {
static get className(): string;
protected constructor(props: ElementProps, iModel: IModelDb);
}
/** Information Reference is an abstract base class for modeling entities whose main purpose is to reference something else.
* @public @preview
*/
export declare abstract class InformationReferenceElement extends InformationContentElement {
static get className(): string;
protected constructor(props: ElementProps, iModel: IModelDb);
}
/** A Subject is an information element that describes what this repository (or part thereof) is about.
* @public @preview
*/
export declare class Subject extends InformationReferenceElement {
static get className(): string;
description?: string;
protected constructor(props: SubjectProps, iModel: IModelDb);
toJSON(): SubjectProps;
/** Create a Code for a Subject given a name that is meant to be unique within the scope of its parent Subject.
* @param iModelDb The IModelDb
* @param parentSubjectId The Id of the parent Subject that provides the scope for names of its child Subjects.
* @param codeValue The child Subject name
*/
static createCode(iModelDb: IModelDb, parentSubjectId: CodeScopeProps, codeValue: string): Code;
/** Create a Subject
* @param iModelDb The IModelDb
* @param parentSubjectId The new Subject will be a child of this Subject
* @param name The name (codeValue) of the Subject
* @param description The optional description of the Subject
* @returns The newly constructed Subject
* @throws [[IModelError]] if there is a problem creating the Subject
*/
static create(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, description?: string): Subject;
/** Insert a Subject
* @param iModelDb Insert into this IModelDb
* @param parentSubjectId The new Subject will be inserted as a child of this Subject
* @param name The name (codeValue) of the Subject
* @param description The optional description of the Subject
* @returns The Id of the newly inserted Subject
* @throws [[IModelError]] if there is a problem inserting the Subject
*/
static insert(iModelDb: IModelDb, parentSubjectId: Id64String, name: string, description?: string): Id64String;
}
/** An InformationContentElement that identifies the content of a document.
* The realized form of a document is called a DocumentCarrier (different class than Document).
* For example, a will is a legal document. The will published into a PDF file is an ElectronicDocumentCopy.
* The will printed onto paper is a PrintedDocumentCopy.
* In this example, the Document only identifies, names, and tracks the content of the will.
* @public @preview
*/
export declare abstract class Document extends InformationContentElement {
static get className(): string;
protected constructor(props: ElementProps, iModel: IModelDb);
}
/** A document that represents a drawing, that is, a two-dimensional graphical representation of engineering data. A Drawing element is usually modelled by a [[DrawingModel]].
* @public @preview
*/
export declare class Drawing extends Document {
private _scaleFactor;
/** A factor used by tools to adjust the size of text in [GeometricElement2d]($backend)s in the associated [DrawingModel]($backend) and to compute the
* size of the [ViewAttachment]($backend) created when attaching the [Drawing]($backend) to a [Sheet]($backend).
* Default: 1.
* @note Attempting to set this property to a value less than or equal to zero will produce an exception.
* @public @preview
*/
get scaleFactor(): number;
set scaleFactor(factor: number);
static get className(): string;
protected constructor(props: DrawingProps, iModel: IModelDb);
toJSON(): DrawingProps;
/** The name of the DrawingModel class modeled by this element type. */
protected static get drawingModelFullClassName(): string;
/** Create a Code for a Drawing given a name that is meant to be unique within the scope of the specified DocumentListModel.
* @param iModel The IModelDb
* @param scopeModelId The Id of the DocumentListModel that contains the Drawing and provides the scope for its name.
* @param codeValue The Drawing name
*/
static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code;
/** Insert a Drawing element and a DrawingModel that breaks it down.
* @param iModelDb Insert into this iModel
* @param documentListModelId Insert the new Drawing into this DocumentListModel
* @param name The name of the Drawing.
* @param scaleFactor See [[scaleFactor]]. Must be greater than zero.
* @returns The Id of the newly inserted Drawing element and the DrawingModel that breaks it down (same value).
* @throws [[IModelError]] if unable to insert the element.
* @throws Error if `scaleFactor` is less than or equal to zero.
*/
static insert(iModelDb: IModelDb, documentListModelId: Id64String, name: string, scaleFactor?: number): Id64String;
}
/** A document that represents a section drawing, that is, a graphical documentation derived from a planar
* section of a spatial view. A SectionDrawing element is modelled by a [[SectionDrawingModel]] or a [[GraphicalModel3d]].
* A [[SectionDrawingLocation]] can associate the drawing with a spatial location, enabling [HyperModeling]($hypermodeling).
* @public @preview
*/
export declare class SectionDrawing extends Drawing {
/** The type of section used to generate the drawing. */
sectionType: SectionType;
/** The spatial view from which the section was generated. */
spatialView: RelatedElement;
/** A transform from the section drawing model's coordinates to spatial coordinates. */
drawingToSpatialTransform?: Transform;
/** If the section drawing is placed onto a [[Sheet]] via a [[ViewAttachment]], a transform from the sheet's coordinates to spatial coordinates. */
sheetToSpatialTransform?: Transform;
/** If the section drawing is placed onto a [[Sheet]] via a [[ViewAttachment]], the clip to apply to the sheet graphics when drawn in the context
* of the spatial view.
* @note The ClipVector is defined in spatial coordinates.
*/
drawingBoundaryClip?: ClipVector;
/** If true, when displaying the section drawing as a [DrawingViewState]($frontend), the [[spatialView]] will also be displayed. */
displaySpatialView: boolean;
static get className(): string;
protected static get drawingModelFullClassName(): string;
protected constructor(props: SectionDrawingProps, iModel: IModelDb);
toJSON(): SectionDrawingProps;
}
/** The template for a SheetBorder
* @public @preview
*/
export declare class SheetBorderTemplate extends Document {
static get className(): string;
height?: number;
width?: number;
protected constructor(props: SheetBorderTemplateProps, iModel: IModelDb);
}
/** The template for a [[Sheet]]
* @public @preview
*/
export declare class SheetTemplate extends Document {
static get className(): string;
height?: number;
width?: number;
border?: Id64String;
protected constructor(props: SheetTemplateProps, iModel: IModelDb);
protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
}
/** A digital representation of a *sheet of paper*. Modeled by a [[SheetModel]].
* @public @preview
*/
export declare class Sheet extends Document {
static get className(): string;
height: number;
width: number;
scale?: number;
sheetTemplate?: Id64String;
protected constructor(props: SheetProps, iModel: IModelDb);
protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
/** Create a Code for a Sheet given a name that is meant to be unique within the scope of the specified DocumentListModel.
* @param iModel The IModelDb
* @param scopeModelId The Id of the DocumentListModel that contains the Sheet and provides the scope for its name.
* @param codeValue The Sheet name
*/
static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code;
}
/** Information Record Element is an abstract base class for modeling information records. Information Record
* Element is the default choice if no other subclass of Information Content Element makes sense.
* @public @preview
*/
export declare abstract class InformationRecordElement extends InformationContentElement {
static get className(): string;
protected constructor(props: ElementProps, iModel: IModelDb);
}
/** A Definition Element holds configuration-related information that is meant to be referenced / shared.
* @public @preview
*/
export declare abstract class DefinitionElement extends InformationContentElement {
static get className(): string;
/** If true, don't show this DefinitionElement in user interface lists. */
isPrivate: boolean;
protected constructor(props: DefinitionElementProps, iModel: IModelDb);
/**
* DefinitionElement custom HandledProps includes 'isPrivate'.
* @inheritdoc
* @beta
*/
protected static readonly _customHandledProps: CustomHandledProperty[];
/**
* DefinitionElement deserializes 'isPrivate'.
* @inheritdoc
* @beta
*/
static deserialize(props: DeserializeEntityArgs): DefinitionElementProps;
/**
* DefinitionElement serialize 'isPrivate'.
* @inheritdoc
* @beta
*/
static serialize(props: DefinitionElementProps, iModel: IModelDb): ECSqlRow;
toJSON(): DefinitionElementProps;
}
/** This abstract class unifies DefinitionGroup and DefinitionContainer for relationship endpoint purposes.
* @note The associated ECClass was added to the BisCore schema in version 1.0.10
* @public @preview
*/
export declare abstract class DefinitionSet extends DefinitionElement {
static get className(): string;
}
/** A DefinitionContainer exclusively owns a set of DefinitionElements contained within its sub-model (of type DefinitionModel).
* @note The associated ECClass was added to the BisCore schema in version 1.0.10
* @public @preview
*/
export declare class DefinitionContainer extends DefinitionSet {
static get className(): string;
/** Create a DefinitionContainer
* @param iModelDb The IModelDb
* @param definitionModelId The Id of the [DefinitionModel]($backend) that will contain this DefinitionContainer element.
* @param code The Code for this DefinitionContainer.
* @param isPrivate The optional hint, that if `true` means it should not be displayed in the UI.
* @returns The newly constructed DefinitionContainer
* @note There is not a predefined CodeSpec for DefinitionContainer elements, so it is the responsibility of the domain or application to create one.
* @throws [[IModelError]] if there is a problem creating the DefinitionContainer
*/
static create(iModelDb: IModelDb, definitionModelId: Id64String, code: Code, isPrivate?: boolean): DefinitionContainer;
/** Insert a DefinitionContainer and its sub-model.
* @param iModelDb Insert into this IModelDb
* @param definitionModelId The Id of the [DefinitionModel]($backend) that will contain this DefinitionContainer element.
* @param code The Code for this DefinitionContainer.
* @param isPrivate The optional hint, that if `true` means it should not be displayed in the UI.
* @returns The Id of the newly inserted DefinitionContainer and its newly inserted sub-model (of type DefinitionModel).
* @note There is not a predefined CodeSpec for DefinitionContainer elements, so it is the responsibility of the domain or application to create one.
* @throws [[IModelError]] if there is a problem inserting the DefinitionContainer
*/
static insert(iModelDb: IModelDb, definitionModelId: Id64String, code: Code, isPrivate?: boolean): Id64String;
}
/** A non-exclusive set of DefinitionElements grouped using the DefinitionGroupGroupsDefinitions relationship.
* @note The associated ECClass was added to the BisCore schema in version 1.0.10
* @public @preview
*/
export declare class DefinitionGroup extends DefinitionSet {
static get className(): string;
/** Create a DefinitionGroup
* @param iModelDb The IModelDb
* @param definitionModelId The Id of the [DefinitionModel]($backend) that will contain this DefinitionGroup element.
* @param code The Code for this DefinitionGroup
* @param isPrivate The optional hint, that if `true` means it should not be displayed in the UI.
* @returns The newly constructed DefinitionGroup
* @note There is not a predefined CodeSpec for DefinitionGroup elements, so it is the responsibility of the domain or application to create one.
* @throws [[IModelError]] if there is a problem creating the DefinitionGroup
*/
static create(iModelDb: IModelDb, definitionModelId: Id64String, code: Code, isPrivate?: boolean): DefinitionGroup;
}
/** Defines a set of properties (the *type*) that may be associated with an element.
* @public @preview
*/
export declare abstract class TypeDefinitionElement extends DefinitionElement {
static get className(): string;
recipe?: RelatedElement;
protected constructor(props: TypeDefinitionElementProps, iModel: IModelDb);
protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
}
/** Defines a recipe for generating instances from a definition.
* @beta
*/
export declare abstract class RecipeDefinitionElement extends DefinitionElement {
static get className(): string;
protected constructor(props: ElementProps, iModel: IModelDb);
}
/** Defines a set of properties (the *type*) that can be associated with a Physical Element. A Physical
* Type has a strong correlation with something that can be ordered from a catalog since all instances
* share a common set of properties.
* @public @preview
*/
export declare abstract class PhysicalType extends TypeDefinitionElement {
static get className(): string;
/** If defined, the [[PhysicalMaterial]] that makes up this PhysicalType. */
physicalMaterial?: RelatedElement;
protected constructor(props: PhysicalTypeProps, iModel: IModelDb);
toJSON(): PhysicalTypeProps;
/** Create a Code for a PhysicalType element given a name that is meant to be unique within the scope of the specified DefinitionModel.
* @param iModel The IModelDb
* @param scopeModelId The Id of the DefinitionModel that contains the PhysicalType element and provides the scope for its name.
* @param codeValue The PhysicalType name
*/
static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code;
}
/** Defines a set of properties (the *type*) that can be associated with a spatial location.
* @public @preview
*/
export declare abstract class SpatialLocationType extends TypeDefinitionElement {
static get className(): string;
protected constructor(props: TypeDefinitionElementProps, iModel: IModelDb);
/** Create a Code for a SpatialLocationType element given a name that is meant to be unique within the scope of the specified DefinitionModel.
* @param iModel The IModelDb
* @param scopeModelId The Id of the DefinitionModel that contains the SpatialLocationType element and provides the scope for its name.
* @param codeValue The SpatialLocationType name
*/
static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code;
}
/** A TemplateRecipe3d is a DefinitionElement that has a sub-model that contains the 3d template elements.
* @beta
*/
export declare class TemplateRecipe3d extends RecipeDefinitionElement {
static get className(): string;
protected constructor(props: ElementProps, iModel: IModelDb);
/** Create a Code for a TemplateRecipe3d given a name that is meant to be unique within the scope of its Model.
* @param iModelDb The IModelDb
* @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe3d element.
* @param codeValue The name of the TemplateRecipe3d element.
*/
static createCode(iModelDb: IModelDb, definitionModelId: CodeScopeProps, codeValue: string): Code;
/** Create a TemplateRecipe3d
* @param iModelDb The IModelDb
* @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe3d element.
* @param name The name (Code.value) of the TemplateRecipe3d
* @returns The newly constructed TemplateRecipe3d
* @throws [[IModelError]] if there is a problem creating the TemplateRecipe3d
*/
static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, isPrivate?: boolean): TemplateRecipe3d;
/** Insert a TemplateRecipe3d and a PhysicalModel (sub-model) that will contain the 3d template elements.
* @param iModelDb The IModelDb
* @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe3d element.
* @param name The name (Code.value) of the TemplateRecipe3d
* @returns The Id of the newly inserted TemplateRecipe3d and the PhysicalModel that sub-models it.
* @throws [[IModelError]] if there is a problem inserting the TemplateRecipe3d or its sub-model.
*/
static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, isPrivate?: boolean): Id64String;
}
/** Defines a set of properties (the *type*) that can be associated with a 2D Graphical Element.
* @public @preview
*/
export declare abstract class GraphicalType2d extends TypeDefinitionElement {
static get className(): string;
protected constructor(props: TypeDefinitionElementProps, iModel: IModelDb);
/** Create a Code for a GraphicalType2d element given a name that is meant to be unique within the scope of the specified DefinitionModel.
* @param iModel The IModelDb
* @param scopeModelId The Id of the DefinitionModel that contains the GraphicalType2d element and provides the scope for its name.
* @param codeValue The GraphicalType2d name
*/
static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code;
}
/** A recipe that uses a 2D template for creating new instances.
* @beta
*/
export declare class TemplateRecipe2d extends RecipeDefinitionElement {
static get className(): string;
protected constructor(props: ElementProps, iModel: IModelDb);
/** Create a Code for a TemplateRecipe2d given a name that is meant to be unique within the scope of its Model.
* @param iModelDb The IModelDb
* @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe2d element.
* @param codeValue The name of the TemplateRecipe2d element.
*/
static createCode(iModelDb: IModelDb, definitionModelId: CodeScopeProps, codeValue: string): Code;
/** Create a TemplateRecipe2d
* @param iModelDb The IModelDb
* @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe2d element.
* @param name The name (Code.value) of the TemplateRecipe2d
* @returns The newly constructed TemplateRecipe2d
* @throws [[IModelError]] if there is a problem creating the TemplateRecipe2d
*/
static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, isPrivate?: boolean): TemplateRecipe2d;
/** Insert a TemplateRecipe2d and a DrawingModel (sub-model) that will contain the 2d template elements.
* @param iModelDb The IModelDb
* @param definitionModelId The Id of the [DefinitionModel]($backend) that contains this TemplateRecipe2d element.
* @param name The name (Code.value) of the TemplateRecipe2d
* @returns The Id of the newly inserted TemplateRecipe2d and the PhysicalModel that sub-models it.
* @throws [[IModelError]] if there is a problem inserting the TemplateRecipe2d or its sub-model.
*/
static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, isPrivate?: boolean): Id64String;
}
/** An abstract base class for elements that establishes a particular modeling perspective for its parent Subject.
* Instances are always sub-modeled by a specialization of Model of the appropriate modeling perspective.
* @see [iModel Information Hierarchy]($docs/bis/guide/data-organization/top-of-the-world), [[Subject]], [[Model]]
* @public @preview
*/
export declare abstract class InformationPartitionElement extends InformationContentElement {
static get className(): string;
/** A human-readable string describing the intent of the partition. */
description?: string;
protected constructor(props: InformationPartitionElementProps, iModel: IModelDb);
toJSON(): InformationPartitionElementProps;
/** Create a code that can be used for any subclass of InformationPartitionElement.
* @param iModelDb The IModelDb
* @param parentSubjectId The Id of the parent Subject that provides the scope for names of its child InformationPartitionElements.
* @param codeValue The InformationPartitionElement name
*/
static createCode(iModel: IModelDb, parentSubjectId: CodeScopeProps, codeValue: string): Code;
}
/** A DefinitionPartition element establishes a *Definition* modeling perspective for its parent Subject.
* A DefinitionPartition is always sub-modeled by a DefinitionModel.
* @see [[DefinitionModel]]
* @public @preview
*/
export declare class DefinitionPartition extends InformationPartitionElement {
static get className(): string;
}
/** A DocumentPartition element establishes a *Document* modeling perspective for its parent Subject.
* A DocumentPartition is always sub-modeled by a DocumentListModel.
* @see [[DocumentListModel]]
* @public @preview
*/
export declare class DocumentPartition extends InformationPartitionElement {
static get className(): string;
}
/** A GroupInformationPartition element establishes a *Group Information* modeling perspective for its parent Subject.
* A GroupInformationPartition is always sub-modeled by a GroupInformationModel.
* @see [[GroupInformationModel]]
* @public @preview
*/
export declare class GroupInformationPartition extends InformationPartitionElement {
static get className(): string;
}
/** A GraphicalPartition3d element establishes a *3D Graphical* modeling perspective for its parent Subject.
* A GraphicalPartition3d is always sub-modeled by a GraphicalModel3d.
* @note The associated ECClass was added to the BisCore schema in version 1.0.8
* @see [[GraphicalModel3d]]
* @public @preview
*/
export declare class GraphicalPartition3d extends InformationPartitionElement {
static get className(): string;
}
/** An InformationRecordPartition element establishes a *Information Record* modeling perspective for its parent Subject.
* A InformationRecordPartition is always sub-mo