/** @packageDocumentation * @module Views */ import { BeDuration, BeEvent, Constructor, Id64, Id64Arg, Id64Set, Id64String } from "@itwin/core-bentley"; import { Angle, LowAndHighXY, LowAndHighXYZ, Map4d, Matrix3d, Plane3dByOriginAndUnitNormal, Point3d, Point4d, Range1d, Range3d, Transform, Vector3d, XAndY, XYAndZ, XYZ } from "@itwin/core-geometry"; import { AnalysisStyle, BackgroundMapProps, BackgroundMapProviderProps, BackgroundMapSettings, ClipStyle, ColorDef, DisplayStyleSettingsProps, ElementProps, FeatureAppearance, Frustum, Hilite, ImageBuffer, LightSettings, Placement, PlacementProps, SolarShadowSettings, SubCategoryAppearance, SubCategoryOverride, ViewFlags } from "@itwin/core-common"; import { AuxCoordSystemState } from "./AuxCoordSys"; import { BackgroundMapGeometry } from "./BackgroundMapGeometry"; import { ChangeFlags, MutableChangeFlags } from "./ChangeFlags"; import { CoordSystem } from "./CoordSystem"; import { DisplayStyleState } from "./DisplayStyleState"; import { ElementPicker } from "./ElementLocateManager"; import { FeatureOverrideProvider } from "./FeatureOverrideProvider"; import { HitDetail } from "./HitDetail"; import { IModelConnection } from "./IModelConnection"; import { ToolTipOptions } from "./NotificationManager"; import { PerModelCategoryVisibility } from "./PerModelCategoryVisibility"; import { Decorations } from "./render/Decorations"; import { FeatureSymbology } from "./render/FeatureSymbology"; import { FrameStats } from "./render/FrameStats"; import { Pixel } from "./render/Pixel"; import { GraphicList } from "./render/RenderGraphic"; import { RenderMemory } from "./render/RenderMemory"; import { RenderTarget } from "./render/RenderTarget"; import { StandardViewId } from "./StandardView"; import { SubCategoriesCache } from "./SubCategoriesCache"; import { DisclosedTileTreeSet, MapCartoRectangle, MapFeatureInfo, MapFeatureInfoOptions, MapLayerImageryProvider, MapLayerIndex, MapLayerInfoFromTileTree, MapTileTreeReference, MapTileTreeScaleRangeVisibility, TileBoundingBoxes, TiledGraphicsProvider, TileTreeReference, TileUser } from "./tile/internal"; import { Animator, MarginOptions, OnViewExtentsError, ViewAnimationOptions, ViewChangeOptions } from "./ViewAnimation"; import { DecorateContext, SceneContext } from "./ViewContext"; import { GlobalLocation } from "./ViewGlobalLocation"; import { ViewingSpace } from "./ViewingSpace"; import { ViewPose } from "./ViewPose"; import { ViewRect } from "./common/ViewRect"; import { ModelDisplayTransformProvider, ViewState } from "./ViewState"; import { ViewStatus } from "./ViewStatus"; import { QueryVisibleFeaturesCallback, QueryVisibleFeaturesOptions } from "./render/VisibleFeature"; import { FlashSettings } from "./FlashSettings"; /** Interface for drawing [[Decorations]] into, or on top of, a [[ScreenViewport]]. * @public */ export interface ViewportDecorator { /** Override to enable cached decorations for this decorator. * By default, a decorator is asked to recreate its decorations from scratch via its [[decorate]] method whenever the viewport's decorations are invalidated. * Decorations become invalidated for a variety of reasons, including when the scene changes and when the mouse moves. * Most decorators care only about when the scene changes, and may create decorations that are too expensive to recreate on every mouse motion. * If `useCachedDecorations` is true, then the viewport will cache the most-recently-created decorations for this decorator, and only invoke its [[decorate]] method if it has no cached decorations for it. * The cached decorations are discarded: * - Whenever the scene changes; and * - When the decorator explicitly requests it via [[Viewport.invalidateCachedDecorations]] or [[ViewManager.invalidateCachedDecorationsAllViews]]. * The decorator should invoke the latter when the criteria governing its decorations change. */ readonly useCachedDecorations?: true; /** Implement this method to add [[Decorations]] into the supplied DecorateContext. * @see [[useCachedDecorations]] to avoid unnecessarily recreating decorations. */ decorate(context: DecorateContext): void; } /** Source of depth point returned by [[Viewport.pickDepthPoint]]. * @public */ export declare enum DepthPointSource { /** Depth point from geometry within specified radius of pick point */ Geometry = 0,// eslint-disable-line @typescript-eslint/no-shadow /** Depth point from reality model within specified radius of pick point */ Model = 1, /** Depth point from ray projection to background map plane */ BackgroundMap = 2, /** Depth point from ray projection to ground plane */ GroundPlane = 3, /** Depth point from ray projection to grid plane */ Grid = 4, /** Depth point from ray projection to acs plane */ ACS = 5, /** Depth point from plane passing through view target point */ TargetPoint = 6, /** Depth point from map/terrain within specified radius of pick point */ Map = 7 } /** Options to control behavior of [[Viewport.pickDepthPoint]]. * @public */ export interface DepthPointOptions { /** If true, geometry with the "non-locatable" flag set will not be selected. */ excludeNonLocatable?: boolean; /** If true, geometry from pickable decorations will not be selected. */ excludeDecorations?: boolean; /** If true, geometry from an IModelConnection other than the one associated with the Viewport will not be selected. */ excludeExternalIModels?: boolean; } /** The minimum and maximum values for the z-depth of a rectangle of screen space. * Values are in [[CoordSystem.Npc]] so they will be between 0 and 1.0. * @public */ export interface DepthRangeNpc { /** The value closest to the back. */ minimum: number; /** The value closest to the front. */ maximum: number; } /** Options to allow changing the view rotation with zoomTo methods and ensure minimum bounding box dimensions for zoomToElements. * @public */ export interface ZoomToOptions { /** Set view rotation from standard view identifier. */ standardViewId?: StandardViewId; /** Set view rotation relative to placement of first element or props entry. */ placementRelativeId?: StandardViewId; /** Set view rotation from Matrix3d. */ viewRotation?: Matrix3d; /** Ensure minimum element-aligned bounding box dimensions in meters (3d only). */ minimumDimension?: number; } /** Options for changing the viewed Model of a 2d view via [[Viewport.changeViewedModel2d]] * @public */ export interface ChangeViewedModel2dOptions { /** If true, perform a "fit view" operation after changing to the new 2d model. */ doFit?: boolean; } /** Describes an undo or redo event for a [[Viewport]]. * @see [[Viewport.onViewUndoRedo]]. * @public */ export declare enum ViewUndoEvent { Undo = 0, Redo = 1 } /** @internal */ export declare const ELEMENT_MARKED_FOR_REMOVAL: unique symbol; declare global { interface Element { [ELEMENT_MARKED_FOR_REMOVAL]?: boolean; } } /** Payload for the [[Viewport.onFlashedIdChanged]] event indicating Ids of the currently- and/or previously-flashed objects. * @public */ export type OnFlashedIdChangedEventArgs = { readonly current: Id64String; readonly previous: Id64String; } | { readonly current: Id64String; readonly previous: undefined; } | { readonly previous: Id64String; readonly current: undefined; }; /** Arguments to [[Viewport.getPixelDataWorldPoint]]. * @public */ export interface GetPixelDataWorldPointArgs { /** The buffer containing the pixel data. @see [[Viewport.readPixels]]. */ pixels: Pixel.Buffer; /** The x coordinate of the pixel of interest, in view coordinates. */ x: number; /** The y coordinate of the pixel of interest, in view coordinates. */ y: number; /** If true, then the world point of a pixel associated with a model will preserve any transforms applied to the model at display time, * such as those supplied by a [[ModelDisplayTransformProvider]] or [PlanProjectionSettings.elevation]($common). * Otherwise, the world point will be multiplied by the inverse of any such transforms to correlate it with the model's true coordinate space. */ preserveModelDisplayTransforms?: boolean; /** If supplied, this point will be modified to store the returned point, instead of allocating a new point. */ out?: Point3d; } /** Arguments supplied to [[Viewport.readImageBuffer]]. * @public */ export interface ReadImageBufferArgs { /** The region of the viewport's [[ViewRect]] to capture. It must be fully contained within [[Viewport.viewRect]]. * If unspecified, the entirety of the viewport's view rect is captured. */ rect?: ViewRect; /** Optional dimensions to which to resize the captured image. If the aspect ratio of these dimensions does not match that of the captured image, * horizontal or vertical bars will be added to the resized image using the viewport's background color. * If unspecified, the image will not be resized. */ size?: XAndY; /** The image captured by WebGL appears "upside-down" and must be flipped to appear right-side-up; if true, this flipping will not be performed. * This provides a performance optimization for uncommon cases in which an upside-down image is actually preferred. */ upsideDown?: boolean; } /** MapLayer visibility based on its scale range definition. * @beta */ export interface MapLayerScaleRangeVisibility { /** True if map-layer is part of [[DisplayStyleState]]'s overlay map, otherwise map-layer is part of [[DisplayStyleState]]'s background map * @see [[DisplayStyleState.mapLayerAtIndex]]. */ isOverlay: boolean; /** Index of the map-layer in [[DisplayStyleState]]'s background/overlay map * @see [[DisplayStyleState.mapLayerAtIndex]]. */ index: number; /** Scale range visibility value of the map-layer */ visibility: MapTileTreeScaleRangeVisibility; } /** Arguments supplied to [[Viewport.readPixels]]. * @public * @extensions */ export interface ReadPixelsArgs { /** The function that will be invoked to process the captured pixel data. */ receiver: Pixel.Receiver; /** The region of the viewport's contents to read. If the area is empty or not contained within the [[Viewport.viewRect]], * no pixels will be read. * If omitted, the viewport's entire contents will be read. */ rect?: ViewRect; /** Specifies which aspects of each pixel to read. By default, all aspects are read. */ selector?: Pixel.Selector; /** If true, geometry with the "non-locatable" flag set will not be drawn, potentially revealing locatable geometry it would otherwise obscure. */ excludeNonLocatable?: boolean; /** An optional set of Ids of elements that should not be drawn, potentially revealing other geometry they would otherwise obscure. */ excludedElements?: Iterable; } /** Arguments supplied to [[Viewport.readImageToCanvas]]. * @public */ export interface ReadImageToCanvasOptions { /** If true, canvas decorations will not be included in the saved image. */ omitCanvasDecorations?: boolean; } /** A Viewport renders the contents of one or more [GeometricModel]($backend)s onto an `HTMLCanvasElement`. * * It holds a [[ViewState]] object that defines its viewing parameters; the ViewState in turn defines the [[DisplayStyleState]], * [[CategorySelectorState]], and - for [[SpatialViewState]]s - the [[ModelSelectorState]]. While a ViewState is being displayed by a Viewport, * it is considered to be "attached" to that viewport; it remains attached until the Viewport is disposed of or becomes attached to a different ViewState. * While the ViewState is attached to a Viewport, any changes made to the ViewState or its display style or category/model selectors will be automatically * reflected in the Viewport. A ViewState can be attached to no more than one Viewport at a time. * * As changes to ViewState are made, Viewports also hold a stack of *previous copies* of it, to allow * for undo/redo (i.e. *View Previous* and *View Next*) of viewing tools. * * Changes to a Viewport's state can be monitored by attaching an event listener to a variety of specific events. Most such events are * triggered only once per frame, just before the Viewport's contents are rendered. For example, if the following sequence of events occurs: * * * First frame is rendered * * ViewFlags are modified * * ViewFlags are modified again * * Second frame is rendered * * The [[Viewport.onDisplayStyleChanged]] event will be invoked exactly once, when the second frame is rendered. * * @see [[ScreenViewport]] for a viewport that can render onto the screen. * @see [[OffScreenViewport]] for a viewport that can render into an off-screen buffer. * @public * @extensions */ export declare abstract class Viewport implements Disposable, TileUser { /** Event called whenever this viewport is synchronized with its [[ViewState]]. * @note This event is invoked *very* frequently. To avoid negatively impacting performance, consider using one of the more specific Viewport events; * otherwise, avoid performing excessive computations in response to this event. * @see [[onViewportChanged]] for receiving events at more regular intervals with more specific information about what changed. * @see [[onChangeView]] for an event raised specifically when a different [[ViewState]] becomes associated with the viewport. */ readonly onViewChanged: BeEvent<(vp: Viewport) => void>; /** Event called after reversing the most recent change to the Viewport from the undo stack or reapplying the * most recently undone change to the Viewport from the redo stack. */ readonly onViewUndoRedo: BeEvent<(vp: Viewport, event: ViewUndoEvent) => void>; /** Event called on the next frame after this viewport's set of always-drawn elements changes. */ readonly onAlwaysDrawnChanged: BeEvent<(vp: Viewport) => void>; /** Event called on the next frame after this viewport's set of never-drawn elements changes. */ readonly onNeverDrawnChanged: BeEvent<(vp: Viewport) => void>; /** Event called on the next frame after this viewport's [[DisplayStyleState]] or its members change. * Aspects of the display style include [ViewFlags]($common), [SubCategoryOverride]($common)s, and [[Environment]] settings. */ readonly onDisplayStyleChanged: BeEvent<(vp: Viewport) => void>; /** Event called on the next frame after this viewport's set of displayed categories changes. */ readonly onViewedCategoriesChanged: BeEvent<(vp: Viewport) => void>; /** Event called on the next frame after this viewport's set of [[PerModelCategoryVisibility.Overrides]] changes. */ readonly onViewedCategoriesPerModelChanged: BeEvent<(vp: Viewport) => void>; /** Event called on the next frame after this viewport's set of displayed models changes. */ readonly onViewedModelsChanged: BeEvent<(vp: Viewport) => void>; /** Event called on the next frame after this viewport's [[FeatureOverrideProvider]] changes, * or the internal state of the provider changes such that the overrides needed to be recomputed. */ readonly onFeatureOverrideProviderChanged: BeEvent<(vp: Viewport) => void>; /** Event called on the next frame after this viewport's [[FeatureSymbology.Overrides]] change. */ readonly onFeatureOverridesChanged: BeEvent<(vp: Viewport) => void>; /** Event called on the next frame after any of the viewport's [[ChangeFlags]] changes. */ readonly onViewportChanged: BeEvent<(vp: Viewport, changed: ChangeFlags) => void>; /** Event invoked immediately when [[changeView]] is called to replace the current [[ViewState]] with a different one. */ readonly onChangeView: BeEvent<(vp: Viewport, previousViewState: ViewState) => void>; /** Event invoked immediately when the viewport is disposed. * @see [[Viewport.dispose]]. */ readonly onDisposed: BeEvent<(vp: Viewport) => void>; /** Event invoked after [[renderFrame]] detects that the dimensions of the viewport's [[ViewRect]] have changed. */ readonly onResized: BeEvent<(vp: Viewport) => void>; /** Event dispatched immediately after [[flashedId]] changes, supplying the Ids of the previously and/or currently-flashed objects. * @note Attempting to assign to [[flashedId]] from within the event callback will produce an exception. */ readonly onFlashedIdChanged: BeEvent<(vp: Viewport, args: OnFlashedIdChangedEventArgs) => void>; /** Event indicating when a map-layer scale range visibility change for the current viewport scale. * @beta */ readonly onMapLayerScaleRangeVisibilityChanged: BeEvent<(layerIndexes: MapLayerScaleRangeVisibility[]) => void>; /** Event invoked every time [[invalidateScene]] is called. * @note This event will be raised **very** frequently. Avoid doing significant work inside of your event listener. * @beta */ readonly onSceneInvalidated: BeEvent<(vp: Viewport) => void>; /** @internal */ protected _hasMissingTiles: boolean; /** This is initialized by a call to [[changeView]] sometime shortly after the constructor is invoked. * During that time it can be undefined. DO NOT assign directly to this member - use `setView()`. */ private _view; /** A function executed by `setView()` when `this._view` changes. */ private readonly _detachFromView; private readonly _detachFromDisplayStyle; private readonly _viewportId; private _doContinuousRendering; /** @internal */ protected _inViewChangedEvent: boolean; /** If false, indicates that [[Decorations]] should be recreated when rendering the next frame. * @note prefer to invoke [[invalidateDecorations]] rather than directly assigning to this property. */ protected _decorationsValid: boolean; /** @internal */ protected _sceneValid: boolean; /** @internal */ get sceneValid(): boolean; /** @internal */ protected _renderPlanValid: boolean; /** @internal */ get renderPlanValid(): boolean; /** @internal */ setRenderPlanValid(): void; /** @internal */ protected _controllerValid: boolean; /** @internal */ get controllerValid(): boolean; private _redrawPending; private _analysisFractionValid; /** @internal */ get analysisFractionValid(): boolean; private _timePointValid; /** @internal */ get timePointValid(): boolean; /** Strictly for tests. @internal */ setAllValid(): void; /** Mark the current set of decorations invalid, so that they will be recreated on the next render frame. * This can be useful, for example, if an external event causes one or more current decorations to become invalid and you wish to force * them to be recreated to show the changes. * @note On the next frame, the `decorate` method of all [[ViewManager.decorators]] will be called. There is no way (or need) to * invalidate individual decorations. */ invalidateDecorations(): void; /** Mark the viewport's scene as having changed, so that the next call to [[renderFrame]] will recreate it. * This method is not typically invoked directly - the scene is automatically invalidated in response to events such as moving the viewing frustum, * changing the set of viewed models, new tiles being loaded, etc. */ invalidateScene(): void; /** Mark the viewport's "render plan" as having changed, so that the next call to [[renderFrame]] will recreate it. * This method is not typically invoked directly - the render plan is automatically invalidated in response to events such as changing aspects * of the viewport's [[displayStyle]]. */ invalidateRenderPlan(): void; /** Mark the viewport's [[ViewState]] as having changed, so that the next call to [[renderFrame]] will invoke [[setupFromView]] to synchronize with the view. * This method is not typically invoked directly - the controller is automatically invalidated in response to events such as a call to [[changeView]]. * Additionally, refresh the Reality Tile Tree to reflect changes in the map layer. */ invalidateController(): void; /** @internal */ setValidScene(): void; /** Request that the Viewport redraw its contents on the next frame. This is useful when some state outside of the Viewport's control but affecting its display has changed. * For example, if the parameters affecting a screen-space effect applied to this Viewport are modified, the Viewport's contents should be redrawn to reflect the change. * @note This does not necessarily cause the viewport to recreate its scene, decorations, or anything else - it only guarantees that the contents will be repainted. */ requestRedraw(): void; private _animator?; /** @internal */ protected _changeFlags: MutableChangeFlags; private _selectionSetDirty; private readonly _perModelCategoryVisibility; private _tileSizeModifier?; /** @internal */ readonly subcategories: SubCategoriesCache.Queue; /** Time the current flash started. */ private _flashUpdateTime?; /** Current flash intensity from [0..this.flashSettings.maxIntensity] */ private _flashIntensity; /** Id of the currently flashed element. */ private _flashedElem?; /** Id of last flashed element. */ private _lastFlashedElem?; /** The Id of the most recently flashed element, if any. */ get lastFlashedElementId(): Id64String | undefined; private _wantViewAttachments; /** For debug purposes, controls whether or not view attachments are displayed in sheet views. * @internal */ get wantViewAttachments(): boolean; set wantViewAttachments(want: boolean); private _wantViewAttachmentBoundaries; /** For debug purposes, controls whether or not the boundary of each view attachment is displayed in a sheet view. * @internal */ get wantViewAttachmentBoundaries(): boolean; set wantViewAttachmentBoundaries(want: boolean); private _wantViewAttachmentClipShapes; /** For debug purposes, controls whether or not graphics representing the clipping shapes of each view attachment are displayed in a sheet view. * @internal */ get wantViewAttachmentClipShapes(): boolean; set wantViewAttachmentClipShapes(want: boolean); /** Don't allow entries in the view undo buffer unless they're separated by more than this amount of time. */ static undoDelay: BeDuration; private _debugBoundingBoxes; private _freezeScene; private _viewingSpace; private _target?; private _fadeOutActive; private _neverDrawn?; private _alwaysDrawn?; private _alwaysDrawnExclusive; private readonly _featureOverrideProviders; private readonly _tiledGraphicsProviders; private _mapTiledGraphicsProvider?; private _hilite; private _emphasis; private _flash; /** See [DisplayStyle3dSettings.lights]($common) */ get lightSettings(): LightSettings | undefined; setLightSettings(settings: LightSettings): void; /** See [DisplayStyle3dSettings.solarShadows]($common) */ get solarShadowSettings(): SolarShadowSettings | undefined; setSolarShadowSettings(settings: SolarShadowSettings): void; /** @public */ get viewingSpace(): ViewingSpace; /** This viewport's rotation matrix. */ get rotation(): Matrix3d; /** The vector between the opposite corners of this viewport's extents. */ get viewDelta(): Vector3d; /** Provides conversions between world and view coordinates. */ get worldToViewMap(): Map4d; /** Provides conversions between world and Npc (non-dimensional perspective) coordinates. */ get worldToNpcMap(): Map4d; /** @internal */ get frustFraction(): number; /** See [DisplayStyleSettings.analysisFraction]($common). */ get analysisFraction(): number; set analysisFraction(fraction: number); /** See [DisplayStyleSettings.timePoint]($common) */ get timePoint(): number | undefined; set timePoint(time: number | undefined); /** @internal */ protected readonly _viewRange: ViewRect; /** Get the rectangle of this Viewport in [[CoordSystem.View]] coordinates. * @note Do not modify the ViewRect's properties. */ abstract get viewRect(): ViewRect; /** @internal */ get isAspectRatioLocked(): boolean; /** @internal */ get target(): RenderTarget; /** Returns true if this Viewport's [[dispose]] method has been invoked. It is an error to attempt to interact with a disposed Viewport. * Typically a [[ScreenViewport]] becomes disposed as a result of a call to [[ViewManager.dropViewport]], often indirectly through the unmounting of a nine-zone UI's [[ViewportComponent]] when, e.g., switching front-stages. * @public */ get isDisposed(): boolean; /** The settings that control how elements are hilited in this Viewport. */ get hilite(): Hilite.Settings; set hilite(hilite: Hilite.Settings); /** The settings that control how emphasized elements are displayed in this Viewport. The default settings apply a thick black silhouette to the emphasized elements. * @see [FeatureAppearance.emphasized]($common). */ get emphasisSettings(): Hilite.Settings; set emphasisSettings(settings: Hilite.Settings); /** The settings that control how elements are flashed in this viewport. */ get flashSettings(): FlashSettings; set flashSettings(settings: FlashSettings); /** Determine whether the Grid display is currently enabled in this Viewport. * @return true if the grid display is on. */ get isGridOn(): boolean; /** Flags controlling aspects of how the contents of this viewport are rendered. * @see [DisplayStyleSettings.viewFlags]($common). */ get viewFlags(): ViewFlags; set viewFlags(viewFlags: ViewFlags); /** See [[ViewState.displayStyle]] */ get displayStyle(): DisplayStyleState; set displayStyle(style: DisplayStyleState); /** Selectively override aspects of this viewport's display style. * @see [DisplayStyleSettings.applyOverrides]($common) */ overrideDisplayStyle(overrides: DisplayStyleSettingsProps): void; /** See [DisplayStyleSettings.clipStyle]($common) */ get clipStyle(): ClipStyle; set clipStyle(style: ClipStyle); /** Sets the number of [MSAA]($docs/learning/display/MSAA.md) samples for this viewport. * The number of samples is a power of two. Values of 1 or less indicates anti-aliasing should be disabled. Non-power-of-two values are rounded * down to the nearest power of two. The maximum number of samples supported depends upon the client's graphics hardware capabilities. Higher values produce * a higher-quality image but also may also reduce framerate. * @see [[ViewManager.setAntialiasingAllViews]] to adjust the number of samples for all viewports. */ get antialiasSamples(): number; set antialiasSamples(numSamples: number); /** return true if viewing globe (globeMode is 3D and eye location is far above globe * @alpha */ get viewingGlobe(): boolean; /** Remove any [[SubCategoryOverride]] for the specified subcategory. * @param id The Id of the subcategory. * @see [[overrideSubCategory]] */ dropSubCategoryOverride(id: Id64String): void; /** Override the symbology of geometry belonging to a specific subcategory when rendered within this viewport. * @param id The Id of the subcategory. * @param ovr The symbology overrides to apply to all geometry belonging to the specified subcategory. * @see [[dropSubCategoryOverride]] */ overrideSubCategory(id: Id64String, ovr: SubCategoryOverride): void; /** Query the symbology overrides applied to geometry belonging to a specific subcategory when rendered within this viewport. * @param id The Id of the subcategory. * @return The symbology overrides applied to all geometry belonging to the specified subcategory, or undefined if no such overrides exist. * @see [[overrideSubCategory]] */ getSubCategoryOverride(id: Id64String): SubCategoryOverride | undefined; /** Query the symbology with which geometry belonging to a specific subcategory is rendered within this viewport. * Every [[SubCategory]] defines a base symbology independent of any [[Viewport]]. * If a [[SubCategoryOverride]] has been applied to the subcategory within the context of this [[Viewport]], it will be applied to the subcategory's base symbology. * @param id The Id of the subcategory. * @return The symbology of the subcategory within this viewport, including any overrides. * @see [[overrideSubCategory]] */ getSubCategoryAppearance(id: Id64String): SubCategoryAppearance; /** Determine whether geometry belonging to a specific SubCategory is visible in this viewport, assuming the containing Category is displayed. * @param id The Id of the subcategory * @returns true if the subcategory is visible in this viewport. * @note Because this function does not know the Id of the containing Category, it does not check if the Category is enabled for display. The caller should check that separately if he knows the Id of the Category. */ isSubCategoryVisible(id: Id64String): boolean; /** Override the appearance of a model when rendered within this viewport. * @param id The Id of the model. * @param ovr The symbology overrides to apply to all geometry belonging to the specified subcategory. * @see [DisplayStyleSettings.overrideModelAppearance]($common) */ overrideModelAppearance(id: Id64String, ovr: FeatureAppearance): void; /** Remove any model appearance override for the specified model. * @param id The Id of the model. * @see [DisplayStyleSettings.dropModelAppearanceOverride]($common) */ dropModelAppearanceOverride(id: Id64String): void; /** Some changes may or may not require us to invalidate the scene. * Specifically, when shadows are enabled or we are displaying view attachments, the following changes may affect the visibility or transparency of elements or features: * - Viewed categories and subcategories; * - Always/never drawn elements * - Symbology overrides. */ private maybeInvalidateScene; /** Enable or disable display of elements belonging to a set of categories specified by Id. * Visibility of individual subcategories belonging to a category can be controlled separately through the use of [[SubCategoryOverride]]s. * By default, enabling display of a category does not affect display of subcategories thereof which have been overridden to be invisible. * @param categories The Id(s) of the categories to which the change should be applied. No other categories will be affected. * @param display Whether or not elements on the specified categories should be displayed in the viewport. * @param enableAllSubCategories Specifies that when enabling display for a category, all of its subcategories should also be displayed even if they are overridden to be invisible. * @param batchNotify If true, a single batch event is raised instead of one event per category. This is more efficient when changing many categories at once. */ changeCategoryDisplay(categories: Id64Arg, display: boolean, enableAllSubCategories?: boolean, batchNotify?: boolean): void; private updateSubCategories; private enableAllSubCategories; /** @internal */ getSubCategories(categoryId: Id64String): Id64Set | undefined; /** Change the visibility of geometry belonging to the specified subcategory when displayed in this viewport. * @param subCategoryId The Id of the subcategory * @param display: True to make geometry belonging to the subcategory visible within this viewport, false to make it invisible. */ changeSubCategoryDisplay(subCategoryId: Id64String, display: boolean): void; /** The settings controlling how a background map is displayed within a view. * @see [[ViewFlags.backgroundMap]] for toggling display of the map on or off. * @see [DisplayStyleSettings.backgroundMap]($common) */ get backgroundMapSettings(): BackgroundMapSettings; set backgroundMapSettings(settings: BackgroundMapSettings); /** See [[DisplayStyleState.changeBackgroundMapProps]] */ changeBackgroundMapProps(props: BackgroundMapProps): void; /** See [[DisplayStyleState.changeBackgroundMapProvider]] */ changeBackgroundMapProvider(props: BackgroundMapProviderProps): void; /** A reference to the [[TileTree]] used to display the background map in this viewport, if the background map is being displayed. */ get backgroundMapTileTreeReference(): TileTreeReference | undefined; /** @internal */ get backgroundMap(): MapTileTreeReference | undefined; /** @internal */ get overlayMap(): MapTileTreeReference | undefined; /** @internal */ get backgroundDrapeMap(): MapTileTreeReference | undefined; /** Return the imagery provider for the provided map-layer index. * @param mapLayerIndex the [[MapLayerIndex]] of the map layer. * @beta */ getMapLayerImageryProvider(mapLayerIndex: MapLayerIndex): MapLayerImageryProvider | undefined; /** Return the map-layer scale range visibility for the provided map-layer index. * @param mapLayerIndex the [[MapLayerIndex]] of the map layer. * @see [[DisplayStyleState.mapLayerAtIndex]]. * @beta */ getMapLayerScaleRangeVisibility(mapLayerIndex: MapLayerIndex): MapTileTreeScaleRangeVisibility; /** Return a list of map-layers indexes matching a given MapTile tree Id and a layer imagery tree id. * Note: A imagery tree can be shared for multiple map-layers. * @internal */ getMapLayerIndexesFromIds(mapTreeId: Id64String, layerTreeId: Id64String): MapLayerIndex[]; /** Returns the cartographic range of a map layer. * @param mapLayerIndex the [[MapLayerIndex]] of the map layer. */ getMapLayerRange(mapLayerIndex: MapLayerIndex): Promise; /** Changes viewport to include range of a map layer. * @param mapLayerIndex the [[MapLayerIndex]] of the map layer. * @param vp the viewport. */ viewMapLayerRange(mapLayerIndex: MapLayerIndex, vp: ScreenViewport): Promise; /** Fully reset a map-layer tile tree; by calling this, the map-layer will to go through initialize process again, and all previously fetched tile will be lost. * @beta */ resetMapLayer(mapLayerIndex: MapLayerIndex): void; /** Returns true if this Viewport is currently displaying the model with the specified Id. */ viewsModel(modelId: Id64String): boolean; /** Attempt to change the 2d Model this Viewport is displaying, if its ViewState is a ViewState2d. * @param baseModelId The Id of the new 2d Model to be displayed. * @param options options that determine how the new view is displayed * @note This function *only works* if the viewport is viewing a [[ViewState2d]], otherwise it does nothing. Also note that * the Model of baseModelId should be the same type (Drawing or Sheet) as the current view. * @note this method clones the current ViewState2d and sets its baseModelId to the supplied value. The DisplayStyle and CategorySelector remain unchanged. */ changeViewedModel2d(baseModelId: Id64String, options?: ChangeViewedModel2dOptions & ViewChangeOptions & MarginOptions): Promise; /** Attempt to replace the set of models currently viewed by this viewport, if it is displaying a SpatialView * @param modelIds The Ids of the models to be displayed. * @returns false if this Viewport is not viewing a [[SpatialViewState]] * @note This function *only works* if the viewport is viewing a [[SpatialViewState]], otherwise it does nothing. * @note This function *does not load* any models. If any of the supplied `modelIds` refers to a model that has not been loaded, no graphics will be loaded+displayed in the viewport for that model. * @see [[replaceViewedModels]] for a similar function that also ensures the requested models are loaded. */ changeViewedModels(modelIds: Id64Arg): boolean; /** Attempt to replace the set of models currently viewed by this viewport, if it is displaying a SpatialView * @param modelIds The Ids of the models to be displayed. * @note This function *only works* if the viewport is viewing a [[SpatialViewState]], otherwise it does nothing. * @note If any of the requested models is not yet loaded this function will asynchronously load them before updating the set of displayed models. */ replaceViewedModels(modelIds: Id64Arg): Promise; /** Add or remove a set of models from those models currently displayed in this viewport. * @param modelIds The Ids of the models to add or remove. * @param display Whether or not to display the specified models in the viewport. * @returns false if this Viewport is not viewing a [[SpatialViewState]] * @note This function *only works* if the viewport is viewing a [[SpatialViewState]], otherwise it does nothing. * @note This function *does not load* any models. If `display` is `true` and any of the supplied `models` refers to a model that has not been loaded, no graphics will be loaded+displayed in the viewport for that model. * @see [[addViewedModels]] for a similar function that also ensures the requested models are loaded. */ changeModelDisplay(models: Id64Arg, display: boolean): boolean; /** Adds a set of models to the set of those currently displayed in this viewport. * @param modelIds The Ids of the models to add or remove. * @param display Whether or not to display the specified models in the viewport. * @note This function *only works* if the viewport is viewing a [[SpatialViewState]], otherwise it does nothing. * @note If any of the requested models is not yet loaded this function will asynchronously load them before updating the set of displayed models. */ addViewedModels(models: Id64Arg): Promise; /** Determines what type (if any) of debug graphics will be displayed to visualize [[Tile]] volumes. Chiefly for debugging. * @see [[TileBoundingBoxes]] */ get debugBoundingBoxes(): TileBoundingBoxes; set debugBoundingBoxes(boxes: TileBoundingBoxes); /** When true, the scene will never be recreated. Chiefly for debugging purposes. * @internal */ get freezeScene(): boolean; set freezeScene(freeze: boolean); /** The iModel of this Viewport */ get iModel(): IModelConnection; /** @internal */ get isPointAdjustmentRequired(): boolean; /** @internal */ get isSnapAdjustmentRequired(): boolean; /** @internal */ get isContextRotationRequired(): boolean; /** Enables or disables "fade-out" mode. When this mode is enabled, transparent graphics are rendered with a flat alpha weight, * causing them to appear de-emphasized. This is typically used in contexts in which a handful of elements are to be emphasized in the view, * while the rest of the graphics are drawn transparently. */ get isFadeOutActive(): boolean; set isFadeOutActive(active: boolean); /** Obtain a tooltip from the map layer or reality model, if any, identified by the specified [[HitDetail]]. * @see [[ElementLocateManager]] */ getToolTip(hit: HitDetail): Promise; /** Obtain feature information from a map layer model, if any, identified by the specified [[HitDetail]]. * @see [[ElementLocateManager]] * @see [[MapFeatureInfo]] * @beta */ getMapFeatureInfo(hit: HitDetail, options?: MapFeatureInfoOptions): Promise; /** If this event has one or more listeners, collection of timing statistics related to rendering frames is enabled. Frame statistics will be received by the listeners whenever a frame is finished rendering. * @note The timing data collected using this event only collects the amount of time spent on the CPU. Due to performance considerations, time spent on the GPU is not collected. Therefore, these statistics are not a direct mapping to user experience. * @note In order to avoid interfering with the rendering loop, take care to avoid performing any intensive tasks in your event listeners. * @see [[FrameStats]] * @alpha */ readonly onFrameStats: BeEvent<(frameStats: Readonly) => void>; private _frameStatsCollector; /** A function invoked once, after the constructor, to initialize the viewport's state. * Subclasses can use this perform additional initialization, as the viewport's constructor is not directly invokable. */ protected initialize(): void; /** @internal because subclasses must derive from ScreenViewport or OffScreenviewport. */ protected constructor(target: RenderTarget); [Symbol.dispose](): void; /** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */ dispose(): void; private setView; /** @internal Invoked when the viewport becomes associated with a new ViewState to register event listeners with the view * and allow the ViewState to set up internal state that is only relevant when associated with a Viewport. * Also invoked after changing OffScreenViewport.drawingToSheetTransform. * @internal */ protected attachToView(): void; private registerViewListeners; private registerDisplayStyleListeners; /** @internal Invoked when the viewport becomes associated with a new ViewState to unregister event listeners for * the previous ViewState and allow the previous ViewState to clean up any internal state that is only relevant while * associated with a Viewport. * Also invoked after changing OffScreenViewport.drawingToSheetTransform. * @internal */ protected detachFromView(): void; private detachFromDisplayStyle; /** Enables or disables continuous rendering. Ideally, during each render frame a Viewport will do as little work as possible. * To make that possible, the viewport keeps track of what has changed about its internal state from one frame to the next. * For example, if the view frustum has not changed since the previous frame, it is likely that the viewport does not need to be * re-rendered at all. * * In some circumstances, it is desirable to bypass the logic that limits the amount of work performed each frame. A primary example * is a viewport that has some animations applied to it, or when diagnostic information like frames-per-second is being monitored. * * @note An application which enables continuous rendering should disable it as soon as it is no longer needed. */ get continuousRendering(): boolean; set continuousRendering(contRend: boolean); /** A unique integer Id assigned to this Viewport upon construction. * It can be useful for comparing and sorting Viewport objects inside of collections like [SortedArray]($core-bentley). */ get viewportId(): number; /** The ViewState for this Viewport */ get view(): ViewState; /** @internal */ get pixelsPerInch(): number; /** @internal */ get backgroundMapGeometry(): BackgroundMapGeometry | undefined; /** Ids of a set of elements which should not be rendered within this view. * @note Do not modify this set directly - use [[setNeverDrawn]] or [[clearNeverDrawn]] instead. * @note This set takes precedence over the [[alwaysDrawn]] set - if an element is present in both sets, it is never drawn. */ get neverDrawn(): Id64Set | undefined; /** Ids of a set of elements which should always be rendered within this view, regardless of category and subcategory visibility. * If the [[isAlwaysDrawnExclusive]] flag is also set, *only* those elements in this set will be drawn. * @note Do not modify this set directly - use [[setAlwaysDrawn]] or [[clearAlwaysDrawn]] instead. * @note The [[neverDrawn]] set takes precedence - if an element is present in both sets, it is never drawn. */ get alwaysDrawn(): Id64Set | undefined; /** Clear the set of always-drawn elements. * @see [[alwaysDrawn]] */ clearAlwaysDrawn(): void; /** Clear the set of never-drawn elements. * @see [[neverDrawn]] */ clearNeverDrawn(): void; /** Specify the Ids of a set of elements which should never be rendered within this view. * @see [[neverDrawn]]. */ setNeverDrawn(ids: Id64Set): void; /** Specify the Ids of a set of elements which should always be rendered within this view, regardless of category and subcategory visibility. * @param ids The Ids of the elements to always draw. * @param exclusive If true, *only* the specified elements will be drawn. * @see [[alwaysDrawn]] * @see [[isAlwaysDrawnExclusive]] */ setAlwaysDrawn(ids: Id64Set, exclusive?: boolean): void; /** Returns true if the set of elements in the [[alwaysDrawn]] set are the *only* elements rendered within this view. */ get isAlwaysDrawnExclusive(): boolean; /** Allows visibility of categories within this viewport to be overridden on a per-model basis. */ get perModelCategoryVisibility(): PerModelCategoryVisibility.Overrides; /** Adds visibility overrides for any subcategories whose visibility differs from that defined by the view's * category selector in the context of specific models. * @internal */ addModelSubCategoryVisibilityOverrides(fs: FeatureSymbology.Overrides, ovrs: Id64.Uint32Map): void; /** Add a [[FeatureOverrideProvider]] to customize the appearance of [[Feature]]s within the viewport. * The provider will be invoked whenever the overrides are determined to need updating. * The overrides can be explicitly marked as needing a refresh by calling [[Viewport.setFeatureOverrideProviderChanged]]. This is typically called when * the internal state of the provider changes such that the computed overrides must also change. * @note A Viewport can have any number of FeatureOverrideProviders. No attempt is made to resolve conflicts between two different providers overriding the same Feature. * @param provider The provider to register. * @returns true if the provider was registered, or false if the provider was already registered. * @see [[dropFeatureOverrideProvider]] to remove the provider. * @see [[findFeatureOverrideProvider]] to find an existing provider. * @see [[FeatureSymbology.Overrides]]. */ addFeatureOverrideProvider(provider: FeatureOverrideProvider): boolean; /** Removes the specified FeatureOverrideProvider from the viewport. * @param provider The provider to drop. * @returns true if the provider was dropped, or false if it was not registered. * @see [[addFeatureOverrideProvider]]. */ dropFeatureOverrideProvider(provider: FeatureOverrideProvider): boolean; /** Locate the first registered FeatureOverrideProvider matching the supplied criterion. * @param predicate A function that will be invoked for each provider currently registered with the viewport, returning true to accept the provider. * @returns The first registered provider that matches the predicate, or undefined if no providers match the predicate. * @see [[findFeatureOverrideProviderOfType]] to locate a provider of a specific class. * @see [[addFeatureOverrideProvider]] to register a provider. */ findFeatureOverrideProvider(predicate: (provider: FeatureOverrideProvider) => boolean): FeatureOverrideProvider | undefined; /** The list of [[FeatureOverrideProvider]]s registered with this viewport. * @see [[addFeatureOverrideProvider]] to register a new provider. * @see [[dropFeatureOverrideProvider]] to unregister a provider. * @see [[findFeatureOverrideProvider]] or [[findFeatureOverrideProviderOfType]] to find a registered provider. */ get featureOverrideProviders(): Iterable; /** Locate the first registered FeatureOverrideProvider of the specified class. For example, to locate a registered [[EmphasizeElements]] provider: * ```ts * const provider: EmphasizeElements = viewport.findFeatureOverrideProviderOfType(EmphasizeElements); * ``` * @see [[findFeatureOverrideProvider]] to locate a registered provider matching any arbitrary criterion. */ findFeatureOverrideProviderOfType(type: Constructor): T | undefined; /** @internal */ addFeatureOverrides(ovrs: FeatureSymbology.Overrides): void; /** Notifies this viewport that the internal state of its [[FeatureOverrideProvider]] has changed such that its * [[FeatureSymbology.Overrides]] should be recomputed. */ setFeatureOverrideProviderChanged(): void; /** Notifies this viewport that a change in application state requires its [[FeatureSymbology.Overrides]] to be recomputed. * @note The viewport monitors various events to automatically detect when the overrides should be recomputed. This method * is only needed for changes that are not observable by the viewport itself. */ invalidateSymbologyOverrides(): void; /** The [[TiledGraphicsProvider]]s currently registered with this viewport. * @see [[addTiledGraphicsProvider]]. */ get tiledGraphicsProviders(): Iterable; /** @internal */ protected tiledGraphicsProviderRefs(): Iterable; /** Apply a function to every tile tree reference associated with the map layers displayed by this viewport. * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [[mapTileTreeRefs]] instead. */ forEachMapTreeRef(func: (ref: TileTreeReference) => void): void; /** Obtain an iterator over the tile tree references used to render map imagery in this viewport, if any. */ get mapTileTreeRefs(): Iterable; /** Apply a function to every [[TileTreeReference]] displayed by this viewport. * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [[getTileTreeRefs]] instead. */ forEachTileTreeRef(func: (ref: TileTreeReference) => void): void; /** Iterate over every [[TileTreeReference]] displayed by this viewport. */ getTileTreeRefs(): Iterable; /** * Returns true if all [[TileTree]]s required by this viewport have been loaded. */ get areAllTileTreesLoaded(): boolean; /** Disclose *all* TileTrees currently in use by this Viewport. This set may include trees not reported by [[forEachTileTreeRef]] - e.g., those used by view attachments, map-draped terrain, etc. * @internal */ discloseTileTrees(trees: DisclosedTileTreeSet): void; /** Register a provider of tile graphics to be drawn in this viewport. * @see [[dropTiledGraphicsProvider]] */ addTiledGraphicsProvider(provider: TiledGraphicsProvider): void; /** Remove a previously-registered provider of tile graphics. * @see [[addTiledGraphicsProvider]] */ dropTiledGraphicsProvider(provider: TiledGraphicsProvider): void; /** Returns true if the specified provider has been registered with this viewport via [[addTiledGraphicsProvider]]. */ hasTiledGraphicsProvider(provider: TiledGraphicsProvider): boolean; /** @internal */ mapLayerFromHit(hit: HitDetail): MapLayerInfoFromTileTree[]; /** @internal */ mapLayerFromIds(mapTreeId: Id64String, layerTreeId: Id64String): MapLayerInfoFromTileTree[]; /** @internal */ getTerrainHeightRange(): Range1d; /** @internal */ setViewedCategoriesPerModelChanged(): void; /** @internal */ markSelectionSetDirty(): void; /** True if this is a 3d view with the camera turned on. */ get isCameraOn(): boolean; /** @internal */ changeDynamics(dynamics: GraphicList | undefined, overlay: GraphicList | undefined): void; private _assigningFlashedId; /** The Id of the currently-flashed object. * The "flashed" visual effect is typically applied to the object in the viewport currently under the mouse cursor, to indicate * it is ready to be interacted with by a tool. [[ToolAdmin]] is responsible for updating it when the mouse cursor moves. * The object is usually an [Element]($backend) but could also be a [Model]($backend) or pickable decoration produced by a [[Decorator]]. * The setter ignores any string that is not a well-formed [Id64String]($core-bentley). Passing [Id64.invalid]($core-bentley) to the * setter is equivalent to passing `undefined` - both mean "nothing is flashed". * @throws Error if an attempt is made to change this property from within an [[onFlashedIdChanged]] event callback. * @see [[onFlashedIdChanged]] to be notified when the flashed object changes. * @see [[flashSettings]] to customize the visual effect. */ get flashedId(): Id64String | undefined; set flashedId(id: Id64String | undefined); get auxCoordSystem(): AuxCoordSystemState; getAuxCoordRotation(result?: Matrix3d): Matrix3d; getAuxCoordOrigin(result?: Point3d): Point3d; /** The number of outstanding requests for tiles to be displayed in this viewport. * @see Viewport.numSelectedTiles */ get numRequestedTiles(): number; /** The number of tiles selected for display in the view as of the most recently-drawn frame. * The tiles selected may not meet the desired level-of-detail for the view, instead being temporarily drawn while * tiles of more appropriate level-of-detail are loaded asynchronously. * @see Viewport.numRequestedTiles * @see Viewport.numReadyTiles */ get numSelectedTiles(): number; /** The number of tiles which were ready and met the desired level-of-detail for display in the view as of the most recently-drawn frame. * These tiles may *not* have been selected because some other (probably sibling) tiles were *not* ready for display. * This is a useful metric for determining how "complete" the view is - e.g., one indicator of progress toward view completion can be expressed as: * ` (numReadyTiles) / (numReadyTiles + numRequestedTiles)` * @see Viewport.numSelectedTiles * @see Viewport.numRequestedTiles */ get numReadyTiles(): number; /** @internal */ toViewOrientation(from: XYZ, to?: XYZ): void; /** @internal */ fromViewOrientation(from: XYZ, to?: XYZ): void; /** Change the ViewState of this Viewport * @param view a fully loaded (see discussion at [[ViewState.load]] ) ViewState * @param _opts options for how the view change operation should work */ changeView(view: ViewState, _opts?: ViewChangeOptions): void; /** Determine whether the supplied point is visible in the viewport rectangle. * @param point the point to test * @param coordSys the coordinate system of the specified point * @param borderPaddingFactor optional border for testing with inset view rectangle. */ isPointVisibleXY(point: Point3d, coordSys?: CoordSystem, borderPaddingFactor?: number): boolean; /** Computes the range of npc depth values for a region of the screen * @param rect the rectangle to test. If undefined, test entire view * @param result optional DepthRangeNpc to store the result * @returns the minimum and maximum depth values within the region, or undefined. */ determineVisibleDepthRange(rect?: ViewRect, result?: DepthRangeNpc): DepthRangeNpc | undefined; /** Turn the camera off it is currently on. * @see [[turnCameraOn]] to turn the camera on. */ turnCameraOff(): void; /** Turn the camera on if it is currently off. If the camera is already on, adjust it to use the supplied lens angle. * @param lensAngle The lens angle for the camera. If undefined, use view.camera.lens. * @note This method will fail if the ViewState is not 3d. * @see [[turnCameraOff]] to turn the camera off. */ turnCameraOn(lensAngle?: Angle): ViewStatus; /** Orient this viewport to one of the [[StandardView]] rotations. */ setStandardRotation(id: StandardViewId): void; private doSetupFromView; /** Establish the parameters of this Viewport from the current information in its ViewState */ setupFromView(pose?: ViewPose): ViewStatus; /** Call [[setupFromView]] on this Viewport and then apply optional behavior. * @param options _options for behavior of view change. If undefined, all options have their default values (see [[ViewChangeOptions]] for details.) */ synchWithView(_options?: ViewChangeOptions): void; /** Convert an array of points from CoordSystem.View to CoordSystem.Npc */ viewToNpcArray(pts: Point3d[]): void; /** Convert an array of points from CoordSystem.Npc to CoordSystem.View */ npcToViewArray(pts: Point3d[]): void; /** Convert a point from CoordSystem.View to CoordSystem.Npc * @param pt the point to convert * @param out optional location for result. If undefined, a new Point3d is created. */ viewToNpc(pt: Point3d, out?: Point3d): Point3d; /** Convert a point from CoordSystem.Npc to CoordSystem.View * @param pt the point to convert * @param out optional location for result. If undefined, a new Point3d is created. */ npcToView(pt: Point3d, out?: Point3d): Point3d; /** Convert an array of points from CoordSystem.World to CoordSystem.Npc */ worldToNpcArray(pts: Point3d[]): void; /** Convert an array of points from CoordSystem.Npc to CoordSystem.World */ npcToWorldArray(pts: Point3d[]): void; /** Convert an array of points from CoordSystem.World to CoordSystem.View */ worldToViewArray(pts: Point3d[]): void; /** Convert an array of points from CoordSystem.World to CoordSystem.View, as Point4ds */ worldToView4dArray(worldPts: Point3d[], viewPts: Point4d[]): void; /** Convert an array of points from CoordSystem.View to CoordSystem.World */ viewToWorldArray(pts: Point3d[]): void; /** Convert an array of points from CoordSystem.View as Point4ds to CoordSystem.World */ view4dToWorldArray(viewPts: Point4d[], worldPts: Point3d[]): void; /** Convert a point from CoordSystem.World to CoordSystem.Npc * @param pt the point to convert * @param out optional location for result. If undefined, a new Point3d is created. */ worldToNpc(pt: XYAndZ, out?: Point3d): Point3d; /** Convert a point from CoordSystem.Npc to CoordSystem.World * @param pt the point to convert * @param out optional location for result. If undefined, a new Point3d is created. */ npcToWorld(pt: XYAndZ, out?: Point3d): Point3d; /** Convert a point from CoordSystem.World to CoordSystem.View * @param pt the point to convert * @param out optional location for result. If undefined, a new Point3d is created. */ worldToView(input: XYAndZ, out?: Point3d): Point3d; /** Convert a point from CoordSystem.World to CoordSystem.View as Point4d * @param input the point to convert * @param out optional location for result. If undefined, a new Point4d is created. */ worldToView4d(input: XYAndZ, out?: Point4d): Point4d; /** Convert a point from CoordSystem.View to CoordSystem.World * @param pt the point to convert * @param out optional location for result. If undefined, a new Point3d is created. */ viewToWorld(input: XYAndZ, out?: Point3d): Point3d; /** Convert a point from CoordSystem.View as a Point4d to CoordSystem.View * @param input the point to convert * @param out optional location for result. If undefined, a new Point3d is created. */ view4dToWorld(input: Point4d, out?: Point3d): Point3d; /** Converts inches to pixels based on screen DPI. * @Note this information may not be accurate in some browsers. * @param inches the number of inches to convert * @returns the corresponding number of pixels */ pixelsFromInches(inches: number): number; /** Get an 8-point Frustum corresponding to the 8 corners of the Viewport in the specified coordinate system. * * There are two sets of corners that may be of interest. * The "adjusted" box is the one that is computed by examining the "viewed extents" and moving * the front and back planes to enclose everything in the view. * The "unadjusted" box is the one that is stored in the ViewState. * @param sys Coordinate system for points * @param adjustedBox If true, retrieve the adjusted box. Otherwise retrieve the box that came from the view definition. * @param box optional Frustum for return value * @return the view frustum * @note The "adjusted" box may be either larger or smaller than the "unadjusted" box. */ getFrustum(sys?: CoordSystem, adjustedBox?: boolean, box?: Frustum): Frustum; /** Get a copy of the current (unadjusted) frustum of this viewport, in world coordinates. */ getWorldFrustum(box?: Frustum): Frustum; /** Scroll the view by a given number of pixels. * @param screenDist distance to scroll, in pixels */ scroll(screenDist: XAndY, options?: ViewChangeOptions): void; /** Zoom the view by a scale factor, placing the new center at the given point (world coordinates). * @param newCenter The new center point of the view, in world coordinates. If undefined, use current center. * @param factor the zoom factor. * @param options options for behavior of view change */ zoom(newCenter: Point3d | undefined, factor: number, options?: ViewChangeOptions & MarginOptions & OnViewExtentsError): ViewStatus; /** See [[zoomToPlacements]]. */ zoomToPlacementProps(placementProps: PlacementProps[], options?: ViewChangeOptions & MarginOptions & ZoomToOptions): void; /** Zoom the view in or out to a fit to the tightest volume enclosing a given set of placements, optionally also changing the view rotation. * @param placements The array of placements. The view will zoom to fit the union of the placements. * @param options Options controlling how the view change works and whether to change view rotation. * @note any invalid placements are ignored. If no valid placements are supplied, this function does nothing. * @see [[zoomToElements]] to zoom to a set of elements. * @see [[IModelConnection.Elements.getPlacements]] to obtain the placements for a set of elements. */ zoomToPlacements(placements: Placement[], options?: ViewChangeOptions & MarginOptions & ZoomToOptions): void; /** Zoom the view to a show the tightest box around a given set of ElementProps. Optionally, change view rotation. * @param props element props. Will zoom to the union of the placements. * @param options options that control how the view change works and whether to change view rotation. * @note Do not query for ElementProps just to zoom to their placements - [[zoomToElements]] is much more efficient because it queries only for the placement properties. */ zoomToElementProps(elementProps: ElementProps[], options?: ViewChangeOptions & MarginOptions & ZoomToOptions): void; /** Zoom the view to a show the tightest box around a given set of elements. Optionally, change view rotation. * @param ids the element id(s) to include. Will zoom to the union of the placements. * @param options options that control how the view change works and whether to change view rotation. */ zoomToElements(ids: Id64Arg, options?: ViewChangeOptions & MarginOptions & ZoomToOptions): Promise; /** Zoom the view to a volume of space in world coordinates. * @param volume The low and high corners, in world coordinates. * @param options options that control how the view change works */ zoomToVolume(volume: LowAndHighXYZ | LowAndHighXY, options?: ViewChangeOptions & MarginOptions): void; /** Shortcut to call view.setupFromFrustum and then [[setupFromView]] * @param inFrustum the new viewing frustum * @returns true if both steps were successful */ setupViewFromFrustum(inFrustum: Frustum): boolean; /** Compute the range of all geometry to be displayed in this viewport. */ computeViewRange(): Range3d; /** Set or clear the animator for this Viewport. * @param animator The new animator for this Viewport, or undefined to remove current animator. * @note current animator's `interrupt` method will be called (if it has not completed yet) * @public */ setAnimator(animator?: Animator): void; /** Replace this viewport's [[ViewState]] **without** triggering events like [[onChangeView]]. * This is chiefly useful when you are synchronizing the states of two or more viewports, as in [[TwoWayViewportSync]], to avoid triggering unwanted "echo" * events during synchronization. * In all other scenarios, [[changeView]] is the correct method to use. */ applyViewState(val: ViewState): void; /** Invoked from finishUndoRedo, applyViewState, and changeView to potentially recompute change flags based on differences between current and new ViewState. */ protected updateChangeFlags(newView: ViewState): void; private static roundGrid; private getGridOrientation; private pointToStandardGrid; /** @internal */ pointToGrid(point: Point3d): void; /** Get the width of a pixel (a unit vector in the x direction in view coordinates) at a given point in world coordinates, returning the result in meters (world units). * * This is most useful to determine how large something is in a view. In particular, in a perspective view * the result of this method will be a larger number for points closer to the back of the view Frustum (that is, * one pixel of the view represents more spatial area at the back of the Frustum than the front.) * @param point The point to test, in World coordinates. If undefined, the center of the view in NPC space is used. * @returns The width of a view pixel at the supplied world point, in meters. * @note A "pixel" refers to a logical (CSS) pixel, not a device pixel. */ getPixelSizeAtPoint(point?: Point3d): number; private get _wantInvertBlackAndWhite(); /** Get a color that will contrast to the current background color of this Viewport. Either Black or White depending on which will have the most contrast. */ getContrastToBackgroundColor(): ColorDef; private processFlash; /** Create a context appropriate for producing the scene to be rendered by this viewport, e.g., by [[createScene]]. */ createSceneContext(): SceneContext; /** Populate the context with the scene to be rendered by this viewport. * @note This method is not typically invoked directly - [[renderFrame]] invokes it as needed to recreate the scene. */ createScene(context: SceneContext): void; /** Called when the visible contents of the viewport are redrawn. * @note Due to the frequency of this event, avoid performing expensive work inside event listeners. */ readonly onRender: BeEvent<(vp: Viewport) => void>; /** @internal */ protected validateRenderPlan(): void; private animate; /** Renders the contents of this viewport. This method performs only as much work as necessary based on what has changed since * the last frame. If nothing has changed since the last frame, nothing is rendered. * @note This method should almost never be invoked directly - it is invoked on your behalf by [[ViewManager]]'s render loop. */ renderFrame(): void; /** Populate a set of decoration graphics to be displayed in this viewport. * This base implementation produces no graphics. */ protected addDecorations(_decorations: Decorations): void; /** Capture selected data about each pixel within a rectangular region of this Viewport. * @param rect The area of the viewport's contents to read. The origin specifies the upper-left corner. Must lie entirely within the viewport's dimensions. This input viewport is specified using CSS pixels not device pixels. * @param selector Specifies which aspect(s) of data to read. * @param receiver A function accepting a [[Pixel.Buffer]] object from which the selected data can be retrieved, or receiving undefined if the viewport has been disposed, the rect is out of bounds, or some other error. The pixels received will be device pixels, not CSS pixels. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]]. * @param excludeNonLocatable If true, geometry with the "non-locatable" flag set will not be drawn. * @note The [[Pixel.Buffer]] supplied to the `receiver` function becomes invalid once that function exits. Do not store a reference to it. */ readPixels(rect: ViewRect, selector: Pixel.Selector, receiver: Pixel.Receiver, excludeNonLocatable?: boolean): void; /** Capture selected data about each pixel within a rectangular region of this viewport. * @note The [[Pixel.Buffer]] supplied to [[ReadPixelsArgs.receiver]] becomes invalid once that function exits. Do not store a reference to it. */ readPixels(args: ReadPixelsArgs): void; private _readPixels; /** @internal */ isPixelSelectable(pixel: Pixel.Data): boolean; /** Capture the image currently rendered in this viewport, or a subset thereof. * @param args Describes the region to capture and optional resizing. By default the entire image is captured with no resizing. * @returns The image, or `undefined` if the specified capture rect is not fully contained in [[viewRect], a 2d context could not be obtained, or the resultant image consists entirely * of 100% transparent background pixels. */ readImageBuffer(args?: ReadImageBufferArgs): ImageBuffer | undefined; /** Reads the current image from this viewport into an HTMLCanvasElement with a Canvas2dRenderingContext such that additional 2d graphics can be drawn onto it. * When using this overload, the returned image will not include canvas decorations if only one viewport is active. * If multiple viewports are active, the returned image will always include canvas decorations. * @deprecated in 5.0 - will not be removed until after 2026-06-13. Use the overload accepting a ReadImageToCanvasOptions. */ readImageToCanvas(): HTMLCanvasElement; /** Reads the current image from this viewport into an HTMLCanvasElement with a Canvas2dRenderingContext such that additional 2d graphics can be drawn onto it. * This overload allows for specifying whether canvas decorations will be omitted from the returned image by passing in [[ReadImageToCanvasOptions]]. * The canvas decorations will be consistently omitted or included regardless of the number of active viewports. * @param options Options for reading the image to the canvas. */ readImageToCanvas(options: ReadImageToCanvasOptions): HTMLCanvasElement; /** Used internally by `waitForSceneCompletion`. * @internal */ protected hasAdditionalTiles(): boolean; /** Returns a Promise that resolves after the contents of this viewport are fully loaded and rendered. * This can be useful, for example, when you want to capture an image of the viewport's contents, as in the following code: * ```ts * async function captureImage(vp: Viewport): Promise { * await vp.waitForSceneCompletion(); * return vp.readImageBuffer(); * } * ``` */ waitForSceneCompletion(): Promise; /** Get the point at the specified x and y location in the pixel buffer in npc coordinates. * @see [[getPixelDataWorldPoint]] to obtain the point in [[CoordSystem.World]]. */ getPixelDataNpcPoint(pixels: Pixel.Buffer, x: number, y: number, out?: Point3d): Point3d | undefined; /** Get the point at the specified x and y location in the pixel buffer in world coordinates. * @see [[getPixelDataNpcPoint]] to obtain the point in [[CoordSystem.Npc]]. */ getPixelDataWorldPoint(args: GetPixelDataWorldPointArgs): Point3d | undefined; /** Query which [Feature]($common)s are currently visible within the viewport. * @param options Specifies how to query. * @param callback Callback to invoke with the results. * @note This function may be slow, especially if the features are being queried from screen pixels. Avoid calling it repeatedly in rapid succession. */ queryVisibleFeatures(options: QueryVisibleFeaturesOptions, callback: QueryVisibleFeaturesCallback): void; /** Record graphics memory consumed by this viewport. */ collectStatistics(stats: RenderMemory.Statistics): void; /** Intended strictly as a temporary solution for interactive editing applications, until official support for such apps is implemented. * Invalidates tile trees for all specified models (or all viewed models, if none specified), causing subsequent requests for tiles to make new requests to back-end for updated tiles. * @internal */ refreshForModifiedModels(modelIds: Id64Arg | undefined): void; /** A multiplier applied to the size in pixels of a [[Tile]] during tile selection for this viewport. Defaults to [[TileAdmin.defaultTileSizeModifier]] but can be overridden per-viewport. * A value greater than 1.0 causes lower-resolution tiles to be selected; a value less than 1.0 causes higher-resolution tiles to be selected. * This can allow an application to sacrifice quality for performance or vice-versa. * @alpha */ get tileSizeModifier(): number; /** Controls this Viewport's [[tileSizeModifier]]. * @param modifier If defined, overrides [[TileAdmin.defaultTileSizeModifier]]; otherwise, resets it to that default. Must be greater than zero. * @alpha */ setTileSizeModifier(modifier: number | undefined): void; /** The device pixel ratio used by this Viewport. This value is *not* necessarily equal to `window.devicePixelRatio`. * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio */ get devicePixelRatio(): number; /** Convert a number in CSS pixels to device pixels using this Viewport's device pixel ratio. * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio * @param num The number in CSS pixels to scale * @returns The resulting number in device pixels */ cssPixelsToDevicePixels(cssPixels: number): number; /** See [[ViewState.setModelDisplayTransformProvider]] * @internal */ setModelDisplayTransformProvider(provider: ModelDisplayTransformProvider): void; /** An ordered list of names of screen-space post-processing effects to be applied to the image rendered by the Viewport. * The effects are applied to the image in the order in which they appear in the list. Any names not corresponding to a registered effect are ignored. * This may have no effect if the Viewport's [[RenderTarget]] does not support screen-space effects. * @see [[RenderSystem.createScreenSpaceEffectBuilder]] to create and register new effects. * @public */ get screenSpaceEffects(): Iterable; set screenSpaceEffects(effects: Iterable); /** Append a screen-space effect to the list of effects applied to this Viewport. * @see [[Viewport.screenSpaceEffects]]. * @public */ addScreenSpaceEffect(effectName: string): void; /** Remove all screen-space effects from this Viewport. * @see [[Viewport.screenSpaceEffects]]. * @public */ removeScreenSpaceEffects(): void; /** Add an event listener to be invoked whenever the [AnalysisStyle]($common) associated with this viewport changes. * The analysis style may change for any of several reasons: * - When the viewport's associated [DisplayStyleSettings.analysisStyle]($common). * - When the viewport's associated [[ViewState.displayStyle]] changes. * - When the viewport's associated [[ViewState]] changes via [[changeView]]. * @param listener Callback accepting the new analysis style, or undefined if there is no analysis style. * @returns A function that can be invoked to remove the event listener. */ addOnAnalysisStyleChangedListener(listener: (newStyle: AnalysisStyle | undefined) => void): () => void; /** TileUser implementation @internal */ get tileUserId(): number; /** TileUser implementation @internal */ onRequestStateChanged(): void; /** @internal See [[OffScreenViewport.drawingToSheetTransform */ get drawingToSheetTransform(): Transform | undefined; set drawingToSheetTransform(_: Transform | undefined); } /** An interactive Viewport that exists within an HTMLDivElement. ScreenViewports can receive HTML events. * To render the contents of a ScreenViewport, it must be added to the [[ViewManager]] via ViewManager.addViewport(). * Every frame, the ViewManager will update the Viewport's state and re-render its contents if anything has changed. * To halt this loop, use ViewManager.dropViewport() to remove the viewport from the ViewManager. * * A ScreenViewport internally owns significant WebGL resources which must be explicitly disposed of when the viewport is no longer needed. * This is achieved by invoking the viewport's dispose() method. ViewManager.dropViewport() invokes dispose() on the viewport by default. * * The lifetime of a ScreenViewport typically follows a pattern: * ``` * 1. Application creates the viewport via ScreenViewport.create() * 2. The viewport is added to the render loop via ViewManager.addViewport() * 3. When the application is finished with the viewport, it removes it from the render loop and disposes of it via ViewManager.dropViewport(). * ``` * * In some cases it may be useful to temporarily suspend a viewport's render loop. In this case the lifetime of the viewport proceeds as follows: * ``` * 1. Application creates the viewport via ScreenViewport.create() * 2. The viewport is added to the render loop via ViewManager.addViewport() * 3. At some point the render loop is suspended via ViewManager.dropViewport(viewport, false), indicating the viewport should not be disposed. * 4. Optionally, resume rendering by returning to step 2. * 5. When the application is finished with the viewport: * 5a. If it is currently registered with the ViewManager, it is dropped and disposed of via ViewManager.dropViewport() * 5b. Otherwise, it is disposed of by invoking its dispose() method directly. * ``` * * @see [[ScreenViewport.create]] to create a ScreenViewport. * @public * @extensions */ export declare class ScreenViewport extends Viewport { /** Settings that may be adjusted to control the way animations are applied to a [[ScreenViewport]] by methods like * [[changeView]] and [[synchWithView]. */ static animation: { /** Duration of animations of viewing operations. */ time: { fast: BeDuration; normal: BeDuration; slow: BeDuration; /** Duration used when zooming with the mouse wheel. */ wheel: BeDuration; }; /** The easing function to use for view animations. */ easing: (k: number) => number; /** Pertains to view transitions that move far distances, but maintain the same view direction. * In that case we zoom out, move the camera, and zoom back in rather than transitioning linearly to * provide context for the starting and ending positions. These settings control how and when that happens. */ zoomOut: { /** Whether to allow zooming out. If you don't want it, set this to false. */ enable: boolean; /** The interpolation function used for camera height and position over the zoomOut operation. */ interpolation: (v: any, k: number) => number; /** Array of fractional height the camera rises over the animation. Height is interpolated over the array during the duration of the zoom operation. * At 1.0 it will be high enough that both are visible if the camera were centered between then. * Must start and end at 0. */ heights: number[]; /** Array of fractional positions of the camera from starting to ending location when zooming. * Position is interpolated from the array using the interpolation function over the duration of the zoom operation (see tween.ts) * Must start at 0 and end at 1. */ positions: number[]; /** Zoom out/in only if the beginning and ending view's range, each expanded by this factor, overlap. */ margin: number; /** Multiply the duration of the animation by this factor when performing a zoom out. */ durationFactor: number; }; }; private _evController?; private _resizeObserver?; private _viewCmdTargetCenter?; /** The number of entries in the view undo/redo buffer. */ maxUndoSteps: number; private readonly _forwardStack; private readonly _backStack; private _currentBaseline?; private _lastPose?; private _webglCanvas?; private _logo; private readonly _decorationCache; /** The parent HTMLDivElement of the canvas. */ readonly parentDiv: HTMLDivElement; /** The div created to hold all viewport elements. */ readonly vpDiv: HTMLDivElement; /** The canvas to display the view contents. */ readonly canvas: HTMLCanvasElement; /** The HTMLDivElement used for HTML decorations. May be referenced from the DOM by class "overlay-decorators". * @internal */ readonly decorationDiv: HTMLDivElement; /** The HTMLDivElement used for toolTips. May be referenced from the DOM by class "overlay-tooltip". */ readonly toolTipDiv: HTMLDivElement; /** Create a new ScreenViewport that shows a View of an iModel into an HTMLDivElement. This method will create a new HTMLCanvasElement as a child of the supplied parentDiv. * It also creates two new child HTMLDivElements: one of class "overlay-decorators" for HTML overlay decorators, and one of class * "overlay-tooltip" for ToolTips. All the new child HTMLElements are the same size as the parentDiv. * @param parentDiv The HTMLDivElement to contain the ScreenViewport. The element must have non-zero width and height. * @param view The ViewState for the ScreenViewport. * @note After creating a new ScreenViewport, you must call [[ViewManager.addViewport]] for it to become "live". You must also ensure you dispose of it properly. * @throws Error if `parentDiv` has zero width or height. */ static create(parentDiv: HTMLDivElement, view: ViewState): ScreenViewport; /** @internal */ [Symbol.dispose](): void; /** @internal */ invalidateScene(): void; /** Forces removal of a specific decorator's cached decorations from this viewport, if they exist. * This will force those decorations to be regenerated. * @see [[ViewportDecorator.useCachedDecorations]]. */ invalidateCachedDecorations(decorator: ViewportDecorator): void; /** @internal */ static markAllChildrenForRemoval(el: HTMLDivElement): void; /** @internal */ static removeMarkedChildren(el: HTMLDivElement): void; /** Remove all of the children of an HTMLDivElement. * @internal */ static removeAllChildren(el: HTMLDivElement): void; /** set Div style to absolute, {0,0,100%,100%} * @internal */ static setToParentSize(div: HTMLElement): void; /** add a child element to this.vpDiv and set its size and position the same as the parent. */ private addChildDiv; /** Add a new `HTMLDivElement` as a child of this viewport's div. * @param className The CSS class name to apply to the div. * @param overflowHidden Whether to set `div.style.overflow` to "hidden" instead of "visible". * @param z The Z index of the div relative to its sibling `HTMLElement`s. * @returns the new div. */ addNewDiv(className: string, overflowHidden: boolean, z: number): HTMLDivElement; /** The HTMLImageElement of the iTwin.js logo displayed in this ScreenViewport. */ get logo(): HTMLImageElement; /** @internal */ protected addLogo(): void; protected constructor(canvas: HTMLCanvasElement, parentDiv: HTMLDivElement, target: RenderTarget); /** Open the toolTip window in this ScreenViewport with the supplied message and location. The tooltip will be a child of [[ScreenViewport.toolTipDiv]]. * @param message The message to display * @param location The position of the toolTip, in view coordinates. If undefined, use center of view. * @param options the ToolTip options * @note There is only one ToolTip window, so calling this method more than once will move the toolTip and show the second message. */ openToolTip(message: HTMLElement | string, location?: XAndY, options?: ToolTipOptions): void; /** @internal */ mousePosFromEvent(ev: MouseEvent): XAndY; /** @internal */ mouseMovementFromEvent(ev: MouseEvent): XAndY; /** Invoked by ViewManager.addViewport. * @internal */ onViewManagerAdd(): void; /** Invoked by ViewManager.dropViewport. * @internal */ onViewManagerDrop(): void; /** Find a point on geometry visible in this Viewport, within a radius of supplied pick point. * @param pickPoint Point to search about, in world coordinates * @param radius Radius, in pixels, of the circular area to search. * @param allowNonLocatable If true, include geometry with non-locatable flag set. * @param out Optional Point3d to hold the result. If undefined, a new Point3d is returned. * @returns The point, in world coordinates, on the element closest to `pickPoint`, or undefined if no elements within `radius`. */ pickNearestVisibleGeometry(pickPoint: Point3d, radius?: number, allowNonLocatable?: boolean, out?: Point3d): Point3d | undefined; /** @internal */ picker: ElementPicker; /** Find a point on geometry visible in this Viewport, within a radius of supplied pick point. * If no geometry is selected, return the point projected to the most appropriate reference plane. * @param pickPoint Point to search about, in world coordinates * @param radius Radius, in pixels, of the circular area to search. * @param options Optional settings to control what can be selected. * @returns A plane with origin from closest geometry point or reference plane projection and the source of the depth point. * @note The result plane normal is valid when the source is not geometry or a reality model. */ pickDepthPoint(pickPoint: Point3d, radius?: number, options?: DepthPointOptions): { plane: Plane3dByOriginAndUnitNormal; source: DepthPointSource; sourceId?: string; }; /** Queue an animation that interpolates between this viewport's previous [Frustum]($common) and its current frustum. * This function is typically called by [ViewTool]($frontend)s after modifying the viewport's [ViewState]($frontend), to smoothly transition to the new view; * as opposed to calling [[synchWithView]] which immediately transitions to the new view. It uses [[FrustumAnimator]] to perform the animation. * @public */ animateFrustumChange(options?: ViewAnimationOptions): void; /** Animate the view frustum from a starting frustum to the current view frustum. In other words, * save a starting frustum (presumably what the user is currently looking at), then adjust the view to * a different location and call synchWithView, then call this method. After the animation the viewport * frustum will be restored to its current location. * @internal */ animateToCurrent(_start: Frustum, options?: ViewAnimationOptions): void; /** Animate the view frustum to a destination location the earth from the current frustum. */ animateFlyoverToGlobalLocation(destination: GlobalLocation): Promise; /** @internal */ pickCanvasDecoration(pt: XAndY): import("./core-frontend").CanvasDecoration | undefined; /** Get the DOMRect of the canvas for this Viewport. */ getClientRect(): DOMRect; /** The ViewRect for this ScreenViewport. Left and top will be 0, right will be the width, and bottom will be the height. * @note Do not modify the ViewRect's properties. */ get viewRect(): ViewRect; /** Populate a set of decoration graphics to be displayed in this viewport. */ protected addDecorations(decorations: Decorations): void; /** Change the cursor for this Viewport */ setCursor(cursor?: string): void; /** See [[Viewport.synchWithView]]. */ synchWithView(options?: ViewChangeOptions): void; /** @internal */ protected validateRenderPlan(): void; /** Change the ViewState of this Viewport * @param view a fully loaded (see discussion at [[ViewState.load]] ) ViewState * @param opts options for how the view change operation should work */ changeView(view: ViewState, opts?: ViewChangeOptions): void; /** A point in world coordinates describing an appropriate default point for a [[ViewTool]] when no more specific point is provided by the user. * This point is generally managed and used by [[ViewManip]]. */ get viewCmdTargetCenter(): Point3d | undefined; set viewCmdTargetCenter(center: Point3d | undefined); /** True if an undoable viewing operation exists on the stack */ get isUndoPossible(): boolean; /** True if a redoable viewing operation exists on the stack */ get isRedoPossible(): boolean; /** Clear the undo buffers of this Viewport. This resets the undo stack. */ clearViewUndo(): void; /** Saves the current state of this viewport's [[ViewState]] in the undo stack, such that it can be restored by a call to [[ScreenViewport.doUndo]]. */ saveViewUndo(): void; /** Reverses the most recent change to the Viewport from the undo stack. */ doUndo(animationTime?: BeDuration): void; /** Re-applies the most recently un-done change to the Viewport from the redo stack. */ doRedo(animationTime?: BeDuration): void; /** @internal */ private finishUndoRedo; /** Clear the view undo buffer and establish the current ViewState as the new baseline. */ resetUndo(): void; /** Show the surface normal for geometry under the cursor when snapping. */ private static drawLocateHitDetail; /** @internal */ drawLocateCursor(context: DecorateContext, viewPt: Point3d, aperture: number, isLocateCircleOn: boolean, hit?: HitDetail): void; /** By default, a Viewport's webgl content is rendered to an off-screen canvas owned by the RenderSystem, then the resultant image is copied to the 2d rendering context * belonging to the Viewport's own canvas. However, on non-chromium-based browsers this copying incurs a significant performance penalty. So, when only one Viewport * needs to be drawn, we can switch to rendering the webgl content directly to the screen to improve performance in those browsers. * ViewManager takes care of toggling this behavior. * @internal */ get rendersToScreen(): boolean; set rendersToScreen(toScreen: boolean); /** Overrides [[Viewport.waitForSceneCompletion]] to allow the render loop to load graphics until the scene is complete. */ waitForSceneCompletion(): Promise; } /** Options supplied when creating an [[OffScreenViewport]]. * @see [[OffScreenViewport.create]]. * @public */ export interface OffScreenViewportOptions { /** The view to be drawn in the viewport. */ view: ViewState; /** The dimensions of the viewport. */ viewRect: ViewRect; /** If true, the viewport's aspect ratio will remain fixed. */ lockAspectRatio?: boolean; } /** A viewport that draws to an offscreen buffer instead of to the screen. An offscreen viewport is never added to the [[ViewManager]], therefore does not participate in * the render loop. Its dimensions are specified directly instead of being derived from an HTMLCanvasElement, and its renderFrame function must be manually invoked. * Offscreen viewports can be useful for, e.g., producing an image from the contents of a view (see [[Viewport.readImageBuffer]] and [[Viewport.readImageToCanvas]]) * without drawing to the screen. * @see [[OffScreenViewport.create]] to create an off-screen viewport. * @public * @extensions */ export declare class OffScreenViewport extends Viewport { protected _isAspectRatioLocked: boolean; private _drawingToSheetTransform?; protected constructor(target: RenderTarget); /** A bit of a hack to work around our ill-advised decision to always expect a RenderClipVolume to be defined in world coordinates. * When we attach a section drawing to a sheet view, and the section drawing has a spatial view attached to *it*, the spatial view's clip * is transformed into drawing space - but when we display it we need to transform it into world (sheet) coordinates. * Fixing the actual problem (clips should always be defined in the coordinate space of the graphic branch containing them) would be quite error-prone * and likely to break existing code -- so instead the SheetViewState specifies this transform to be consumed by DrawingViewState.attachToViewport. * @internal */ get drawingToSheetTransform(): Transform | undefined; set drawingToSheetTransform(transform: Transform | undefined); static create(options: OffScreenViewportOptions): OffScreenViewport; /** @internal because RenderTarget is internal */ static createViewport(view: ViewState, target: RenderTarget, lockAspectRatio?: boolean): OffScreenViewport; /** @internal */ get isAspectRatioLocked(): boolean; /** Get the rectangle of this Viewport in [[CoordSystem.View]] coordinates. * @note Do not modify the ViewRect's properties. */ get viewRect(): ViewRect; /** Change the dimensions of the viewport. */ setRect(rect: ViewRect): void; } //# sourceMappingURL=Viewport.d.ts.map