API Reference > imodeljs-backend > ViewDefinitions > SpatialViewDefinition SpatialViewDefinition Class Defines a view of one or more SpatialModels. The list of viewed models is stored by the ModelSelector. This is how a SpatialViewDefinition selects the elements to display: SpatialViewDefinition ModelSelector ModelIds -------> SpatialModels <----------GeometricElement3d.Model CategorySelector CategoryIds -----> SpatialCategories <----------GeometricElement3d.Category Extends ViewDefinition3d Extended by OrthographicViewDefinition Implements EntityProps ElementProps DefinitionElementProps ViewDefinitionProps ViewDefinition3dProps SpatialViewDefinitionProps Methods Name Description loadModelSelector(): ModelSelector Load this view's ModelSelector from the IModelDb. createWithCamera(iModelDb: IModelDb, definitionModelId: Id64String, name: string, modelSelectorId: Id64String, categorySelectorId: Id64String, displayStyleId: Id64String, range: Range3d, standardView: StandardViewIndex = StandardViewIndex.Iso, cameraAngle: number = Angle.piOver2Radians): SpatialViewDefinition Static Create an SpatialViewDefinition with camera. insertWithCamera(iModelDb: IModelDb, definitionModelId: Id64String, name: string, modelSelectorId: Id64String, categorySelectorId: Id64String, displayStyleId: Id64String, range: Range3d, standardView: StandardViewIndex = StandardViewIndex.Iso, cameraAngle: number = Angle.piOver2Radians): Id64String Static Insert an SpatialViewDefinition with camera On Inherited methods Name Inherited from Description buildConcurrencyControlRequest(opcode: DbOpcode): void Element Add a request for locks, code reservations, and anything else that would be needed to carry out the specified operation. delete(): void Element Delete this Element from the iModel. forEachProperty(func: PropertyCallback, includeCustom: boolean = false): void Entity Call a function for each property of this Entity. getAuxiliaryCoordinateSystemId(): Id64String ViewDefinition The Id of the AuxiliaryCoordinateSystem for this ViewDefinition, or an invalid Id if no ACS is defined. getClassMetaData(): EntityMetaData | undefined Element Get the class metadata for this element. getDisplayLabel(): string Element Get a display label for this Element. getJsonProperty(nameSpace: string): any Element Get a JSON property of this element, by namespace getToolTipMessage(): string[] Element Get a list of HTML strings that describe this Element for the tooltip. getUserProperties(namespace: string): any Element Get a set of JSON user properties by namespace insert(): string Element Insert this Element into the iModel. isDrawingView(): this is DrawingViewDefinition ViewDefinition Type guard for 'instanceof DrawingViewDefinition' isSpatialView(): this is SpatialViewDefinition ViewDefinition Type guard for instanceof SpatialViewDefinition isView2d(): this is ViewDefinition2d ViewDefinition Type guard for 'instanceof ViewDefinition2d` isView3d(): this is ViewDefinition3d ViewDefinition Type guard for instanceof ViewDefinition3d loadCategorySelector(): CategorySelector ViewDefinition Load this view's CategorySelector from the IModelDb. loadDisplayStyle(): DisplayStyle ViewDefinition Load this view's DisplayStyle from the IModelDb. loadDisplayStyle3d(): DisplayStyle3d ViewDefinition3d Load this view's DisplayStyle3d from the IModelDb. removeUserProperties(nameSpace: string): void Element Remove a set of JSON user properties, specified by namespace, from this Element setAuxiliaryCoordinateSystemId(acsId: Id64String): void ViewDefinition Set or clear the AuxiliaryCoordinateSystem for this ViewDefinition. setJsonProperty(nameSpace: string, value: any): void Element setUserProperties(nameSpace: string, value: any): void Element Change a set of user JSON properties of this Element by namespace. update(): void Element Update this Element in the iModel. createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code Static ViewDefinition Create a Code for a ViewDefinition given a name that is meant to be unique within the scope of the specified DefinitionModel. onAllInputsHandled(_id: Id64String, _iModel: IModelDb): void ProtectedStatic Element onBeforeOutputsHandled(_id: Id64String, _iModel: IModelDb): void ProtectedStatic Element onDelete(props: ElementProps, iModel: IModelDb): void ProtectedStatic Element Called before an Element is deleted. onDeleted(_props: ElementProps, _iModel: IModelDb): void ProtectedStatic Element Called after an Element was deleted. onInsert(props: ElementProps, iModel: IModelDb): void ProtectedStatic Element Called before a new Element is inserted. onInserted(props: ElementProps, iModel: IModelDb): void ProtectedStatic Element Called after a new Element was inserted. onUpdate(props: ElementProps, iModel: IModelDb): void ProtectedStatic Element Called before an Element is updated. onUpdated(props: ElementProps, iModel: IModelDb): void ProtectedStatic Element Called after an Element was updated. populateRequest(req: ConcurrencyControl.Request, props: ElementProps, _iModel: IModelDb, opcode: DbOpcode, original: ElementProps | undefined): void Static Element Disclose the codes and locks needed to perform the specified operation on this element Properties Name Type Description modelSelectorId Id64String The Id of the ModelSelector for this SpatialViewDefinition. Inherited properties Name Type Inherited from Description angles YawPitchRollAngles ViewDefinition3d Rotation from world coordinates to view coordinates. camera Camera ViewDefinition3d The camera used for this view, if cameraOn is true. cameraOn boolean ViewDefinition3d If true, camera is used. categorySelectorId Id64String ViewDefinition The element Id of the CategorySelector for this ViewDefinition classFullName Accessor ReadOnly string Entity Get the full BIS class name of this Entity in the form "schema:class". classFullName Accessor StaticReadOnly string Entity Get the full BIS class name of this Entity in the form "schema:class" className Accessor ReadOnly string Entity The name of the BIS class associated with this class. code Code Element The Code for this element details Accessor ReadOnly ViewDetails3d ViewDefinition3d Provides access to optional detail settings for this view. displayStyleId Id64String ViewDefinition The element Id of the DisplayStyle for this ViewDefinition extents Vector3d ViewDefinition3d The extent (size) of the view frustum, in meters, along its x,y,z axes. federationGuid undefined | GuidString Element A FederationGuid assigned to this element by some other federated database id Id64String Entity The Id of this Entity. iModel IModelDb Entity The IModelDb that contains this Entity isPrivate boolean DefinitionElement If true, don't show this DefinitionElement in user interface lists. jsonProperties [key: string]: any Element Optional json properties of this element. model Id64String Element The ModelId of the Model containing this element origin Point3d ViewDefinition3d The lower left back corner of the view frustum. parent undefined | RelatedElement Element The parent element, if present, of this element. schema Static undefined Entity The Schema that defines this class. schemaName Accessor ReadOnly string Entity The name of the BIS Schema that defines this class userLabel undefined | string Element A user-assigned label for this element. Defined in core/backend/src/ViewDefinition.ts Line 604 Last Updated: 13 June, 2024