ViewState Class

The front-end state of a ViewDefinition element. A ViewState is typically associated with a Viewport to display the contents of the view on the screen. A ViewState being displayed by a Viewport is considered to be "attached" to that viewport; a "detached" viewport is not being displayed by any viewport. Because the Viewport modifies the state of its attached ViewState, a ViewState can only be attached to one Viewport at a time. Technically, two Viewports can display two different ViewStates that both use the same DisplayStyleState, but this is discouraged - changes made to the style by one Viewport will affect the contents of the other Viewport.

Extends

Extended by

Implements

Methods

Name Description
_updateMaxGlobalScopeFactor(): void Protected    
adjustAspectRatio(aspect: number): void Adjust the aspect ratio of this ViewState so it matches the supplied value.  
allow3dManipulations(): boolean Abstract Returns true if ViewTools are allowed to operate in three dimensions on this view.  
calculateFocusCorners(): Point3d[]    
calculateFrustum(result?: Frustum): Frustum | undefined Calculate the world coordinate Frustum from the parameters of this ViewState.  
computeFitRange(): Range3d Abstract Compute a range in CoordSystem.World coordinates that tightly encloses the contents of this view.  
equals(other: this): boolean Determine whether this ViewState exactly matches another.  
forEachModel(func: (model: GeometricModelState) => void): void Abstract Execute a function on each viewed model  
getAspectRatio(): number Get the aspect ratio (width/height) of this view  
getAspectRatioSkew(): number Get the aspect ratio skew (x/y, usually 1.0) that is used to exaggerate the y axis of the view.  
getAuxiliaryCoordinateSystemId(): Id64String Get the Id of the auxiliary coordinate system for this ViewState  
getCenter(result?: Point3d): Point3d Get the point at the geometric center of the view.  
getExtents(): Vector3d Abstract Get the extents of this view in CoordSystem.World coordinates.  
getGridOrientation(): GridOrientationType Get the grid settings for this view  
getGridSettings(vp: Viewport, origin: Point3d, rMatrix: Matrix3d, orientation: GridOrientationType): void Populate the given origin and rotation with information from the grid settings from the grid orientation.  
getGridSpacing(): XAndY    
getGridsPerRef(): number    
getModelAppearanceOverride(id: Id64String): FeatureAppearance | undefined Query the symbology overrides applied to a model when rendered using this ViewState.  
getModelDisplayTransform(modelId: Id64String, baseTransform: Transform): Transform Obtain the transform with which the specified model will be displayed, accounting for this view's ModelDisplayTransformProvider. Beta  
getOrigin(): Point3d Abstract Get the origin of this view in CoordSystem.World coordinates.  
getRotation(): Matrix3d Abstract Get the 3x3 ortho-normal Matrix3d for this view.  
getSubCategoryOverride(id: Id64String): SubCategoryOverride | undefined Query the symbology overrides applied to geometry belonging to a specific subcategory when rendered using this ViewState.  
getTargetPoint(result?: Point3d): Point3d Get the target point of the view.  
getUpVector(point: Point3d): Vector3d    
getViewClip(): ClipVector | undefined Get the clipping volume for this view, if defined  
getViewedExtents(): AxisAlignedBox3d Abstract Get the extents of this view in CoordSystem.World coordinates.  
getXVector(result?: Vector3d): Vector3d Get the unit vector that points in the view X (left-to-right) direction.  
getYVector(result?: Vector3d): Vector3d Get the unit vector that points in the view Y (bottom-to-top) direction.  
getZVector(result?: Vector3d): Vector3d Get the unit vector that points in the view Z (front-to-back) direction.  
hasSameCoordinates(other: ViewState): boolean Determine whether this ViewState has the same coordinate system as another one.  
is2d(): this Returns true if this ViewState is-a ViewState2d  
is3d(): this Abstract Returns true if this ViewState is-a ViewState3d  
isCameraEnabled(): this Returns true if this ViewState is-a ViewState3d with the camera currently on.  
isDrawingView(): this Abstract Returns true if this ViewState is-a DrawingViewState  
isSpatialView(): this Abstract Returns true if this ViewState is-a SpatialViewState  
load(): Promise<void> Asynchronously load any required data for this ViewState from the backend.  
lookAtViewAlignedVolume(volume: Range3d, aspect?: number, options?: ViewChangeOptions): void Look at a volume of space defined by a range in view local coordinates, keeping its current rotation.  
lookAtVolume(volume: LowAndHighXYZ | LowAndHighXY, aspect?: number, options?: ViewChangeOptions): void Change the volume that this view displays, keeping its current rotation.  
resetExtentLimits(): void Resets the largest and smallest values allowed for the extents of this ViewState to their default values.  
setAspectRatioSkew(val: number): void Set the aspect ratio skew (x/y) for this view.  
setAuxiliaryCoordinateSystem(acs?: AuxCoordSystemState): void Set or clear the AuxiliaryCoordinateSystem for this view.  
setCategorySelector(categories: CategorySelectorState): void Set the CategorySelector for this view.  
setCenter(center: Point3d): void set the center of this view to a new position.  
setDisplayStyle(style: DisplayStyleState): void    
setExtents(viewDelta: Vector3d): void Abstract Set the extents of this view in CoordSystem.World coordinates.  
setGridSettings(orientation: GridOrientationType, spacing: Point2d, gridsPerRef: number): void Set the grid settings for this view  
setOrigin(viewOrg: XYAndZ): void Abstract Set the origin of this view in CoordSystem.World coordinates.  
setRotation(viewRot: Matrix3d): void Abstract Change the rotation of the view.  
setRotationAboutPoint(rotation: Matrix3d, point?: Point3d): void Set the rotation of this ViewState to the supplied rotation, by rotating it about a point.  
setStandardRotation(id: StandardViewId): void Orient this view to one of the StandardView rotations.  
setViewClip(clip?: ClipVector): void Set or clear the clipping volume for this view.  
setupFromFrustum(inFrustum: Frustum, opts?: ViewChangeOptions): ViewStatus Initialize the origin, extents, and rotation from an existing Frustum  
toJSON(): ViewDefinitionProps Convert to JSON representation.  
toProps(): ViewStateProps Serialize this ViewState as a set of properties that can be used to recreate it via ViewState.createFromProps.  
viewsCategory(id: Id64String): boolean Determine whether the specified Category is displayed in this view  
viewsModel(modelId: Id64String): boolean Abstract Returns true if this view displays the contents of a ViewState.Model specified by Id.  
createFromProps(_props: ViewStateProps, _iModel: IModelConnection): ViewState | undefined Static Create a new ViewState object from a set of properties.  

Inherited methods

Name Inherited from Description
clone(iModel?: IModelConnection): this EntityState Make an independent copy of this EntityState

Properties

Name Type Description
analysisStyle Accessor ReadOnly AnalysisStyle | undefined Get the AnalysisDisplayProperties from the displayStyle of this ViewState.  
areAllTileTreesLoaded Accessor ReadOnly boolean Returns true if all TileTrees required by this view have been loaded.  
auxiliaryCoordinateSystem Accessor ReadOnly AuxCoordSystemState get the auxiliary coordinate system state object for this ViewState.  
backgroundColor Accessor ReadOnly ColorDef Get this view's background color.  
categorySelector Accessor CategorySelectorState Selects the categories that are display by this ViewState.  
defaultExtentLimits Accessor ReadOnly ExtentLimits Returns the default extent limits for this ViewState.  
description undefined | string    
details Accessor ReadOnly ViewDetails Provides access to optional detail settings for this view.  
displayStyle Accessor DisplayStyleState The style that controls how the contents of the view are displayed.  
extentLimits Accessor ExtentLimits Get or set the largest and smallest values allowed for the extents for this ViewState  
globalScopeFactor Accessor ReadOnly number A value that represents the global scope of the view -- a value greater than one indicates that the scope of this view is global (viewing most of Earth).  
isAttachedToViewport Accessor ReadOnly boolean Returns whether this view is currently being displayed by a Viewport.  
isPrivate undefined | false | true    
modelDisplayTransformProvider Accessor ModelDisplayTransformProvider | undefined Specify a provider of per-model display transforms.  
name Accessor ReadOnly string Get the name of the ViewDefinition from which this ViewState originated.  
onDisplayStyleChanged BeEvent<(newStyle: DisplayStyleState) => void> An event raised just before assignment to the ViewState.displayStyle property, only if the view is attached to a Viewport.  
onModelDisplayTransformProviderChanged BeEvent<(newProvider: ModelDisplayTransformProvider | undefined) => void> Event raised just before assignment to the ViewState.modelDisplayTransformProvider property, only if the view is attached to a Viewport. Beta  
onViewedCategoriesChanged BeEvent<() => void> An event raised when the set of categories viewed by this view changes, only if the view is attached to a Viewport.  
scheduleScript Accessor ReadOnly Script | undefined The RenderSchedule.Script that animates the contents of the view, if any.  
viewFlags Accessor ViewFlags Flags controlling various aspects of this view's DisplayStyleState.  

Inherited properties

Name Type Inherited from Description
classFullName Accessor StaticReadOnly string EntityState Get full BIS class name of this Entity in the form "SchemaName:ClassName".
classFullName string EntityState The full class name in the form "schema:class".
className Accessor ReadOnly string EntityState The name of the BIS class associated with this class.
code Code ElementState The Code for this element
federationGuid undefined | GuidString ElementState A FederationGuid assigned to this element by some other federated database
id Id64String EntityState The Id of this Entity.
iModel IModelConnection EntityState The iModel from which this Entity was loaded
jsonProperties [key: string]: any EntityState Optional json properties of this Entity.
model Id64String ElementState The ModelId of the Model containing this element
parent undefined | RelatedElement ElementState The parent Element of this, or undefined if no parent.
schemaName Accessor StaticReadOnly string EntityState The name of the BIS schema for this class.
userLabel undefined | string ElementState A user-assigned label for this element.

Defined in

Last Updated: 30 April, 2021