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.

Extends

Extended by

Implements

Methods

Name Description
allow3dManipulations(): boolean Abstract Returns true if ViewTools are allowed to operate in three dimensions on this view.  
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 one axis of the view.  
getAuxiliaryCoordinateSystemId(): Id64String Get the Id of the auxiliary coordinate system for this ViewState  
getCenter(result?: Primitives.Point3d): Point3d Get the point at the geometric center of the view.  
getDetails(): any    
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    
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?: Primitives.Point3d): Point3d Get the target point of the view.  
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.  
is2d(): boolean Returns true if this ViewState is-a ViewState2d  
is3d(): boolean Returns true if this ViewState is-a ViewState3d  
isSpatialView(): boolean 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, margin?: MarginPercent): 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, margin?: MarginPercent): 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.  
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: Point3d): 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?: Primitives.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): ViewStatus Initialize the origin, extents, and rotation from an existing Frustum
This function is commonly used in the implementation of ViewTools as follows:
1.
 
toJSON(): ViewDefinitionProps    
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 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.  
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 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    
displayStyle DisplayStyleState Selects the styling parameters for this this ViewState.  
extentLimits Accessor ExtentLimits Get or set the largest and smallest values allowed for the extents for this ViewState
The default limits vary based on the type of view:
- Spatial view extents cannot exceed the diameter of the earth.
 
isPrivate undefined | false | true    
name Accessor ReadOnly string Get the name of the ViewDefinition from which this ViewState originated.  
scheduleScript Accessor ReadOnly RenderScheduleState.Script | undefined Get the RenderSchedule.Script from the displayStyle of this viewState  
viewFlags Accessor ReadOnly ViewFlags Get the ViewFlags from the DisplayStyleState of this ViewState.  

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: 03 June, 2019