UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

576 lines • 33.5 kB
/** @packageDocumentation * @module DisplayStyles */ import { CompressedId64Set, Constructor, Id64String } from "@itwin/core-bentley"; import { EntityReferenceSet } from "./EntityReference"; import { ClipVector, Plane3dByOriginAndUnitNormal, Point4d, Range1d, Transform, Vector3d, XYAndZ } from "@itwin/core-geometry"; import { RgbColor } from "./RgbColor"; import { FeatureAppearance, FeatureOverrides } from "./FeatureSymbology"; import { PackedFeatureWithIndex } from "./FeatureTable"; /** Namespace containing types that collectively define a script that animates the contents of a view by adjusting the visibility, position, * and/or symbology of groups of elements over time. A [[RenderSchedule.Script]] is hosted by a [RenderTimeline]($backend) element. The script * can be associated with a [DisplayStyleState]($frontend) by way of its [[DisplayStyleSettings.renderTimeline]] property. * @public */ export declare namespace RenderSchedule { /** Defines how two interpolate between two entries in a [[RenderSchedule.Timeline]]. * @note Currently only Linear and Step are supported. Any other value is treated as Step. * @see [[RenderSchedule.TimelineEntry]]. */ enum Interpolation { /** Each timeline entry's value is discrete - the timeline jumps from one entry's value directly to another. */ Step = 1, /** Given two entries on the timeline and a timepoint in between them, linearly interpolate based on the timepoint's distance between the * two entries. */ Linear = 2 } /** JSON representation of a [[RenderSchedule.TimelineEntry]]. */ interface TimelineEntryProps { /** The time point in seconds in the [Unix Epoch](https://en.wikipedia.org/wiki/Unix_time). */ time: number; /** How to interpolate from this entry to the next entry in the timeline. * Currently, anything other than [[RenderSchedule.Interpolation.Linear]] is treated as [[RenderSchedule.Interpolation.Step]]. * Additional interpolation modes may become supported in the future. */ interpolation?: Interpolation; } /** JSON representation of a [[RenderSchedule.VisibilityEntry]]. */ interface VisibilityEntryProps extends TimelineEntryProps { /** Visibility of the geometry from 0 (invisible) to 100 (fully visible), with intermediate values appearing increasingly less transparent. * Default: 100 (fully visible). */ value?: number; } /** JSON representation of a [[RenderSchedule.ColorEntry]]. */ interface ColorEntryProps extends TimelineEntryProps { /** The color applied to the geometry, with each component specified as an integer in [0, 255]. * e.g., (0, 0, 0) represents black and (255, 255, 255) represents white. * If `undefined`, the geometry is displayed in its actual color. */ value?: { red: number; green: number; blue: number; }; } /** JSON representation of a [[RenderSchedule.CuttingPlane]]. */ interface CuttingPlaneProps { /** (x,y,z) of a point on the plane. */ position: number[]; /** (x, y, z) of the plane direction (towards the clip) */ direction: number[]; /** If true, the clip plane is ignored and the geometry is displayed unclipped. */ visible?: boolean; /** If true, the clip plane is ignored and the geometry is not displayed. */ hidden?: boolean; } /** JSON representation of a [[RenderSchedule.CuttingPlaneEntry]]. */ interface CuttingPlaneEntryProps extends TimelineEntryProps { /** The clip plane, or undefined if the geometry is not clipped. */ value?: CuttingPlaneProps; } /** JSON representation of a [[RenderSchedule.TransformComponents]]. */ interface TransformComponentsProps { /** (x, y, z) of position - applied after rotation. */ position?: number[]; /** Quaternion representing rotation. */ orientation?: number[]; /** (x, y, z) of pivot - applied before rotation. */ pivot?: number[]; } /** JSON representation of a [Transform]($core-geometry) associated with a [[RenderSchedule.TransformEntryProps]]. */ interface TransformProps extends TransformComponentsProps { /** 3 X 4 transformation matrix containing 3 arrays of matrix rows consisting of 4 numbers each: [qx qy qz ax] * where the fourth columnn in each row holds the translation. * `undefined` is equivalent to an identity transform. * This transform is only used if position, orientation, and/or pivot are undefined. */ transform?: number[][]; } /** JSON representation of a [[RenderSchedule.TransformEntry]]. */ interface TransformEntryProps extends TimelineEntryProps { /** The transformation matrix, with `undefined` corresponding to an identity matrix. */ value?: TransformProps; } /** JSON representation of a [[RenderSchedule.Timeline]]. */ interface TimelineProps { /** Timeline controlling the visibility of the associated geometry. */ visibilityTimeline?: VisibilityEntryProps[]; /** Timeline controlling the colors of the associated geometry. */ colorTimeline?: ColorEntryProps[]; /** Timeline applying transforms to the associated geometry. */ transformTimeline?: TransformEntryProps[]; /** Timeline applying [ClipVector]($core-geometry)s to the associated geometry. */ cuttingPlaneTimeline?: CuttingPlaneEntryProps[]; } /** JSON representation of an [[RenderSchedule.ElementTimeline]]. */ interface ElementTimelineProps extends TimelineProps { /** A positive integer that uniquely identifies this timeline among all element timelines in the [[RenderSchedule.Script]]. */ batchId: number; /** The Ids of the elements to which this timeline applies. * @note Prefer the compressed representation - lists of element Ids can be comparatively enormous. * @note For a [[DisplayStyleSettingsProps]] associated with a [DisplayStyleState]($frontend) obtained via [IModelConnection.Views.load]($frontend), * this property will be an empty `CompressedId64Set`. They are omitted to conserve bandwidth and memory because they are not needed for display on the frontend. */ elementIds: Id64String[] | CompressedId64Set; } /** JSON representation of a [[RenderSchedule.ModelTimeline]]. */ interface ModelTimelineProps extends TimelineProps { /** The Id of the [GeometricModelState]($frontend) to which the timeline applies. */ modelId: Id64String; /** @alpha */ realityModelUrl?: string; /** Timelines affecting groups of elements. */ elementTimelines: ElementTimelineProps[]; } /** JSON representation of a [[RenderSchedule.Script]]. */ type ScriptProps = ModelTimelineProps[]; /** Describes the value of some property at a specific point along a [[RenderSchedule.Timeline]]. * @see [[RenderSchedule.VisibilityEntry]] * @see [[RenderSchedule.ColorEntry]] * @see [[RenderSchedule.TransformEntry]] * @see [[RenderSchedule.CuttingPlaneEntry]] */ class TimelineEntry { /** The time point in seconds in the [Unix Epoch](https://en.wikipedia.org/wiki/Unix_time). */ readonly time: number; /** How to interpolate from this entry to the next entry in the timeline. */ readonly interpolation: Interpolation; constructor(props: TimelineEntryProps); toJSON(): TimelineEntryProps; compareTo(other: TimelineEntry): number; equals(other: TimelineEntry): boolean; } /** A timeline entry that controls the visibility of the associated geometry. */ class VisibilityEntry extends TimelineEntry { /** The visibility of the geometry at this point on the timeline, in the range [0, 100] where 0 is completely invisible, 100 is completely visible, * and values in between indicate increasing opacity. */ readonly value: number; constructor(props: VisibilityEntryProps); toJSON(): VisibilityEntryProps; compareTo(other: VisibilityEntry): number; } /** A timeline entry controlling the color of the affected geometry. */ class ColorEntry extends TimelineEntry { /** If defined, the color in which to draw the geometry. If undefined, the geometry is drawn in its actual color. */ readonly value: RgbColor | undefined; constructor(props: ColorEntryProps); toJSON(): ColorEntryProps; compareTo(other: ColorEntry): number; } /** Describes the components of a [[RenderSchedule.TransformEntry]] as a rotation around a pivot point followed by a translation. */ class TransformComponents { /** Pivot point - applied before rotation. */ readonly pivot: Vector3d; /** Quaternion rotation. */ readonly orientation: Point4d; /** Translation - applied after rotation. */ readonly position: Vector3d; constructor(position: Vector3d, pivot: Vector3d, orientation: Point4d); static fromJSON(props: TransformComponentsProps): TransformComponents | undefined; toJSON(): TransformComponentsProps; compareTo(other: TransformComponents): number; equals(other: TransformComponents): boolean; } /** A timeline entry that applies rotation, scaling, and/or translation to the affected geometry. */ class TransformEntry extends TimelineEntry { /** The transform matrix to be applied to the geometry, used only if [[components]] is not defined. */ readonly value: Readonly<Transform>; /** The transform represented as a rotation about a pivot point followed by a translation. If undefined, [[value]] is used instead. */ readonly components?: TransformComponents; constructor(props: TransformEntryProps); toJSON(): TransformEntryProps; compareTo(other: TransformEntry): number; } /** Defines a [ClipPlane]($core-geometry) associated with a [[RenderSchedule.CuttingPlaneEntry]]. */ class CuttingPlane { /** A point on the plane. */ readonly position: XYAndZ; /** The direction perpendicular to the plane pointing toward the clip. */ readonly direction: XYAndZ; /** If true, the clip plane is ignored and the geometry is never clipped. */ readonly visible: boolean; /** If true, the clip plane is ignored and the geometry is always clipped. */ readonly hidden: boolean; constructor(props: CuttingPlaneProps); toJSON(): CuttingPlaneProps; compareTo(other: CuttingPlane): number; equals(other: CuttingPlane): boolean; } /** A timeline entry that applies a [ClipPlane]($core-geometry) to the affected geometry. */ class CuttingPlaneEntry extends TimelineEntry { /** The definition of the [ClipPlane]($core-geometry), or undefined if this entry applies no clipping. */ readonly value: CuttingPlane | undefined; constructor(props: CuttingPlaneEntryProps); toJSON(): CuttingPlaneEntryProps; compareTo(other: CuttingPlaneEntry): number; } /** Identifies a fractional position along a [[RenderSchedule.Timeline]] between any two [[RenderSchedule.TimelineEntry]]'s within a [[RenderSchedule.TimelineEntryList]]. * @internal */ class Interval { /** The index of the first timeline entry within the list. */ lowerIndex: number; /** The index of the second timeline entry within the list. */ upperIndex: number; /** The normalized distance between the two timeline entries. */ fraction: number; constructor(lower?: number, upper?: number, fraction?: number); init(lower?: number, upper?: number, fraction?: number): void; } /** A list of the [[RenderSchedule.TimelineEntry]] objects within a [[RenderSchedule.Timeline]]. The type parameters are: * - T, a subclass of TimelineEntry with a `value` property specifying the value of the property controlled by the timeline at that entry's time point. * - P, the JSON representation from which T is to be constructed. * - V, the type of `T.value`. */ class TimelineEntryList<T extends TimelineEntry & { readonly value: V; }, P extends TimelineEntryProps, V> implements Iterable<T> { private readonly _entries; /** The total time period represented by the entries in this list. */ readonly duration: Range1d; constructor(props: P[], ctor: Constructor<T>); /** The number of entries in the list. */ get length(): number; /** An iterator over the entries in the list. */ [Symbol.iterator](): Iterator<T>; /** Look up an entry by its position in the list. */ getEntry(index: number): T | undefined; /** Look up the value of an entry by its position in the list. */ getValue(index: number): V | undefined; toJSON(): P[]; compareTo(other: TimelineEntryList<T, P, V>): number; equals(other: TimelineEntryList<T, P, V>): boolean; /** @internal */ findInterval(time: number, interval?: Interval): Interval | undefined; } /** A list of [[RenderSchedule.VisibilityEntry]]s within a [[RenderSchedule.Timeline]]. */ class VisibilityTimelineEntries extends TimelineEntryList<VisibilityEntry, VisibilityEntryProps, number> { /** Returns the visibility value for the entry at the specified position in the list, or 100 (fully-visible) if no such entry exists. */ getValue(index: number): number; } /** A list of [[RenderSchedule.TransformEntry]]s within a [[RenderSchedule.Timeline]]. */ class TransformTimelineEntries extends TimelineEntryList<TransformEntry, TransformEntryProps, Readonly<Transform>> { /** Returns the transform for the entry at the specified position in the list, or an identity transform if no such entry exists. */ getValue(index: number): Readonly<Transform>; } /** Specifies how to animate a set of geometry over time within a [[RenderSchedule.Script]]. * A [[RenderSchedule.Script]] can contain any number of [[RenderSchedule.Timeline]]s, each affecting different sets of geometry. * @see [[RenderSchedule.ElementTimeline]] and [[RenderSchedule.ModelTimeline]]. */ class Timeline { /** Sequence controlling the visibility of the geometry. */ readonly visibility?: VisibilityTimelineEntries; /** Sequence controlling the color of the geometry. */ readonly color?: TimelineEntryList<ColorEntry, ColorEntryProps, RgbColor | undefined>; /** Sequence controlling the position, orientation, and/or scale of the geometry. */ readonly transform?: TransformTimelineEntries; /** Sequence controlling how the geometry is clipped. */ readonly cuttingPlane?: TimelineEntryList<CuttingPlaneEntry, CuttingPlaneEntryProps, CuttingPlane | undefined>; /** The total time period represented by this timeline. */ readonly duration: Range1d; /** Indicates whether the schedule editing session has been finalized and is no longer active. * @internal */ isEditingCommitted: boolean; constructor(props: TimelineProps); toJSON(): TimelineProps; compareTo(other: Timeline): number; equals(other: Timeline): boolean; /** Get the visibility of the geometry at the specified time point. */ getVisibility(time: number): number; /** Get the color of the geometry at the specified time point, or undefined if the color is not overridden at that time point. */ getColor(time: number): RgbColor | undefined; /** Get the transform applied to the geometry at the specified time point. */ getAnimationTransform(time: number): Readonly<Transform>; /** Get the clipping plane applied to the geometry at the specified time point, or undefined if the geometry is unclipped at that time point. */ getCuttingPlane(time: number): Plane3dByOriginAndUnitNormal | undefined; /** Create a ClipVector from the [[RenderSchedule.CuttingPlane]] applied to the geometry at the specified time point, if any. */ getClipVector(time: number): ClipVector | undefined; /** @internal */ protected getFeatureAppearance(visibility: number, time: number): FeatureAppearance | undefined; } /** Specifies how to animate the geometry belonging to a set of [GeometricElement]($backend)s as part of a [[RenderSchedule.Script]]. */ class ElementTimeline extends Timeline { /** A positive integer that uniquely identififes this timeline among all ElementTimelines in the [[RenderSchedule.Script]]. */ readonly batchId: number; private readonly _elementIds; private constructor(); static fromJSON(props?: ElementTimelineProps): ElementTimeline; toJSON(): ElementTimelineProps; get containsElementIds(): boolean; private compareElementIds; compareTo(other: ElementTimeline): number; /** @internal */ static getElementIds(ids: Id64String[] | CompressedId64Set): Iterable<Id64String>; /** The Ids of the elements controlled by this timeline. */ get elementIds(): Iterable<Id64String>; /** True if this timeline affects the color or transparency of the elements. */ get containsFeatureOverrides(): boolean; /** If true, applying this timeline requires special tiles to be generated in which groups of elements are batched into nodes. * @internal */ get requiresBatching(): boolean; /** True if this timeline affects the position, orientation, or scale of the elements. */ get containsTransform(): boolean; /** @internal */ addSymbologyOverrides(overrides: FeatureOverrides, time: number): void; } /** Specifies how to animate the geometry within a [GeometricModel]($backend) as part of a [[RenderSchedule.Script]]. */ class ModelTimeline extends Timeline { /** The Id of the [GeometricModel]($backend) to be animated. */ readonly modelId: Id64String; /** @internal */ readonly realityModelUrl?: string; /** Timelines specifying how to animate groups of [GeometricElement]($backend)s within the model. */ readonly elementTimelines: ReadonlyArray<ElementTimeline>; /** @internal */ readonly transformBatchIds: ReadonlyArray<number>; /** True if this timeline affects the color or transparency of the geometry. */ readonly containsFeatureOverrides: boolean; /** True if this timeline applies clipping to the model. */ readonly containsModelClipping: boolean; /** If true, applying this timeline requires special tiles to be generated in which groups of elements are batched into nodes. * @internal */ readonly requiresBatching: boolean; /** True if this timeline affects the position, orientation, or scale of the geometry. */ readonly containsTransform: boolean; /** True if any [[RenderSchedule.ElementTimeline]]s exist and none of them contain any element Ids. This generally indicates that * the backend was instructed to omit the Ids to save space when supplying the script. */ readonly omitsElementIds: boolean; private _maxBatchId?; /** Tile tree suppliers perform **very** frequent ordered comparisons of ModelTimelines. They need to be fast. */ private readonly _cachedComparisons; /** When loading tiles we need to quickly map element Ids to batch Ids. This map is initialized on first call to [[getTimelineForElement]] to facilitate that lookup. */ private _idPairToElementTimeline?; private _discreteBatchIds?; private constructor(); static fromJSON(props?: ModelTimelineProps): ModelTimeline; toJSON(): ModelTimelineProps; compareTo(other: ModelTimeline): number; /** Look up the element timeline with the specified batch Id. */ findByBatchId(batchId: number): ElementTimeline | undefined; /** @internal */ addSymbologyOverrides(overrides: FeatureOverrides, time: number): void; /** Obtain the transform applied to the model at the specified time point, if any. */ getTransform(batchId: number, time: number): Readonly<Transform> | undefined; /** Get the highest batchId of any ElementTimeline in this timeline. */ get maxBatchId(): number; /** Given the two halves of an [Id64]($bentley) return the [[ElementTimeline]] containing the corresponding element. * @note The first call to this method populates a mapping for fast lookup. * @alpha */ getTimelineForElement(idLo: number, idHi: number): ElementTimeline | undefined; /** The batch Ids of the subset of [[elementTimelines]] that apply a transform and/or cutting plane. * @alpha */ get discreteBatchIds(): Set<number>; /** @internal see ImdlReader.readAnimationBranches */ getBatchIdForFeature(feature: PackedFeatureWithIndex): number; } /** Specifies how to animate the contents of a [ViewState]($frontend) over time. The script contains any number of [[RenderSchedule.ModelTimeline]]s, each describing how * to animate one of the models in the view. * @see [RenderTimeline]($backend) to create an [Element]($backend) to host a script. * @see [[DisplayStyleSettings.renderTimeline]] to associate a [RenderTimeline]($backend)'s script with a [DisplayStyle]($backend). * @see [DisplayStyleState.scheduleScript]($frontend) to obtain the script associated with a display style. * @see [[RenderSchedule.ScriptBuilder]] to define a new script. */ class Script { /** Timelines specifying how to animate individual models within the view. */ readonly modelTimelines: ReadonlyArray<ModelTimeline>; /** True if this script applies clipping to any models. */ readonly containsModelClipping: boolean; /** If true, applying this timeline requires special tiles to be generated in which groups of elements are batched into nodes. * @internal */ readonly requiresBatching: boolean; /** True if this script affects the position, orientation, or scale of the geometry. */ readonly containsTransform: boolean; /** True if this script affects the color or transparency of the geometry. */ readonly containsFeatureOverrides: boolean; /** The total time period over which this script animates. */ readonly duration: Range1d; /** The batchIds of all nodes in all timelines that apply a transform. * @internal */ readonly transformBatchIds: ReadonlySet<number>; /** Tile tree references perform **very** frequent ordered comparisons of Scripts. They need to be fast. */ private readonly _cachedComparisons; private _discreteBatchIds?; private _lastFeatureModelTimeline?; private _maxBatchId?; compareTo(other: Script): number; equals(other: Script): boolean; protected constructor(props: Readonly<ScriptProps>); static fromJSON(props: Readonly<ScriptProps>): Script | undefined; toJSON(): ScriptProps; /** Look up the timeline that animates the specified model, if any. */ find(modelId: Id64String): ModelTimeline | undefined; /** @internal */ getTransformBatchIds(modelId: Id64String): ReadonlyArray<number> | undefined; /** @internal */ getTransform(modelId: Id64String, batchId: number, time: number): Readonly<Transform> | undefined; /** @internal */ addSymbologyOverrides(overrides: FeatureOverrides, time: number): void; /** Used by the [Entity.collectReferenceIds]($backend) method overrides in RenderTimeline and DisplayStyle. * @internal */ discloseIds(ids: EntityReferenceSet): void; /** @internal */ modelRequiresBatching(modelId: Id64String): boolean; /** The batch Ids of the subset of [[elementTimelines]] that apply a transform and/or cutting plane. * @alpha */ get discreteBatchIds(): Set<number>; /** @internal see ImdlReader.readAnimationBranches. */ getBatchIdForFeature(feature: PackedFeatureWithIndex): number; /** @alpha */ get maxBatchId(): number; /** * Replaces all elementIds in a ScriptProps object with an empty string. Returns modified ScriptProps. * @param scheduleScript The script props to modify. * @internal */ static removeScheduleScriptElementIds(scheduleScript: RenderSchedule.ScriptProps): RenderSchedule.ScriptProps; } /** A reference to a [[RenderSchedule.Script]], optionally identifying the source of the script. * @see [DisplayStyle.loadScheduleScript]($backend) to obtain the script reference for a display style. * @see [DisplayStyleState.scheduleScript]($frontend) or [DisplayStyleState.changeRenderTimeline]($frontend) to change a display style's script on the frontend. */ class ScriptReference { /** The Id of the element - if any - from which the script originated. * A schedule script may originate from one of the following sources: * - A [RenderTimeline]($backend) element stored in the iModel; or * - The `scheduleScript` JSON property of a [DisplayStyle]($backend) element stored in the iModel; or * - Any other source outside of the iModel, such as code that generates the script on the frontend, a script obtained from some server, etc. * * The [[sourceId]] property identifies the Id of the element from which the script originated; an empty or invalid [Id64String]($bentley) indicates the script did not * originate from any persistent element. If the Id is valid, the contents of [[script]] are assumed to match those stored on the source element. */ readonly sourceId: Id64String; /** The script defining the rendering timelines to be applied. */ readonly script: Script; /** Create a reference to a [[script]] with no [[sourceId]]. */ constructor(script: Script); /** Create a reference to a [[script]] with the specified [[sourceId]]. */ constructor(sourceId: Id64String, script: Script); /** @internal Use one of the public constructor overloads which forward to this one. */ constructor(sourceIdOrScript: Id64String | Script, scriptIfSourceId?: Script); } /** Used as part of a [[RenderSchedule.ScriptBuilder]] to define a [[RenderSchedule.Timeline]]. Functions that append * to the timeline expect entries to be appended in chronological order - i.e., you cannot append an entry that is earlier * than a previously appended entry. * @see [[RenderSchedule.ElementTimelineBuilder]] and [[RenderSchedule.ModelTimelineBuilder]]. */ class TimelineBuilder { /** Timeline controlling visibility. */ visibility?: VisibilityEntryProps[]; /** Timeline controlling color. */ color?: ColorEntryProps[]; /** Timeline controlling position and orientation. */ transform?: TransformEntryProps[]; /** Timeline controlling clipping. */ cuttingPlane?: CuttingPlaneEntryProps[]; /** Append a new [[RenderSchedule.VisibilityEntry]] to the timeline. `time` must be more recent than any previously-appended visibility entries. */ addVisibility(time: number, visibility: number | undefined, interpolation?: Interpolation): void; /** Append a new [[RenderSchedule.ColorEntry]] to the timeline. `time` must be more recent than any previously-appended color entries. */ addColor(time: number, color: RgbColor | { red: number; green: number; blue: number; } | undefined, interpolation?: Interpolation): void; /** Append a new [[RenderSchedule.CuttingPlaneEntry]] to the timeline. `time` must be more recent than any previously-appended cutting plane entries. */ addCuttingPlane(time: number, plane: { position: XYAndZ; direction: XYAndZ; visible?: boolean; hidden?: boolean; } | undefined, interpolation?: Interpolation): void; /** Append a new [[RenderSchedule.TransformEntry]] to the timeline. `time` must be more recent than any previously-appended transform entries. */ addTransform(time: number, transform: Readonly<Transform> | undefined, components?: { pivot: XYAndZ; orientation: Point4d; position: XYAndZ; }, interpolation?: Interpolation): void; /** Obtain the JSON representation of the [[RenderSchedule.Timeline]] produced by this builder. * @see [[RenderSchedule.ScriptBuilder.finish]] to obtain the JSON for the entire [[RenderSchedule.Script]]. */ finish(): TimelineProps; } /** As part of a [[RenderSchedule.ScriptBuilder]], assembles a [[RenderSchedule.ElementTimeline]]. * @see [[RenderSchedule.ModelTimelineBuilder.addElementTimeline]]. */ class ElementTimelineBuilder extends TimelineBuilder { /** A positive integer that uniquely identifies this timeline among all element timelines in the [[RenderSchedule.Script]]. * [[RenderSchedule.ScriptBuilder]] ensures each ElementTimelineBuilder receives a unique batch Id. */ readonly batchId: number; /** The compressed set of Ids of the elements affected by this timeline. */ readonly elementIds: CompressedId64Set; /** Constructor - typically not used directly. * @see [[RenderSchedule.ModelTimelineBuilder.addElementTimeline]] to create an ElementTimelineBuilder. */ constructor(batchId: number, elementIds: CompressedId64Set); /** Obtain the JSON representation of the [[RenderSchedule.ElementTimeline]] produced by this builder. * @see [[RenderSchedule.ScriptBuilder.finish]] to obtain the JSON for the entire [[RenderSchedule.Script]]. */ finish(): ElementTimelineProps; } /** As part of a [[RenderSchedule.ScriptBuilder, assembles a [[RenderSchedule.ModelTimeline]]. * @see [[RenderSchedule.ScriptBuilder.addModelTimeline]]. */ class ModelTimelineBuilder extends TimelineBuilder { /** The Id of the model affected by this timeline. */ readonly modelId: Id64String; /** @internal */ realityModelUrl?: string; private readonly _obtainNextBatchId; private readonly _elements; /** Constructor - typically not used directly. * @see [[RenderSchedule.ScriptBuilder.addModelTimeline]] to create a ModelTimelineBuilder. */ constructor(modelId: Id64String, obtainNextBatchId: () => number); /** Add a new [[RenderSchedule.ElementTimeline]] to be applied to the specified elements. * This function will sort and compress the Ids if they are not already compressed. * */ addElementTimeline(elementIds: CompressedId64Set | Iterable<Id64String>): ElementTimelineBuilder; /** Obtain the JSON representation of the [[RenderSchedule.ModelTimeline]] produced by this builder. * @see [[RenderSchedule.ScriptBuilder.finish]] to obtain the JSON for the entire [[RenderSchedule.Script]]. */ finish(): ModelTimelineProps; } /** Assembles the JSON representation for a new [[RenderSchedule.Script]]. Ensure that entries on any given element timeline are added chronologically. As an extremely simple example, the following code produces a script that changes the color of a single element: * ```ts * const script = new ScriptBuilder(); * const model = script.addModelTimeline("0x123"); * const element = model.addElementTimeline([ "0x456" ]); * element.addColor(Date.now(), new RgbColor(0xff, 0x7f, 0)); * const scriptProps = script.finish(); * ``` */ class ScriptBuilder { private _nextBatchId; private readonly _models; /** Add a new [[RenderSchedule.ModelTimeline]] to be applied to the specified model. */ addModelTimeline(modelId: Id64String): ModelTimelineBuilder; /** Obtain the JSON representation of the [[RenderSchedule.Script]] produced by this builder. * @see [RenderTimeline.scriptProps]($backend) to assign the new script to a RenderTimeline element. */ finish(): ScriptProps; } /** * Describes changes made to a schedule script during an editing session. * Used to notify which model timeline was affected and which element IDs were changed. * * @internal */ interface EditingChanges { timeline: ModelTimeline; elements: Set<Id64String>; } } //# sourceMappingURL=RenderSchedule.d.ts.map