@itwin/core-frontend
Version:
iTwin.js frontend components
80 lines • 4.05 kB
TypeScript
/** @packageDocumentation
* @module Views
*/
import { Id64String } from "@itwin/core-bentley";
import { IModelConnection } from "./IModelConnection";
import { StandardViewId } from "./StandardView";
import { ViewState } from "./ViewState";
/** Api for creating a 3d default view for an iModel. Either takes in a list of modelIds, or displays all 3d models by default. */
/** Options for creating a [[ViewState3d]] via [[ViewCreator3d]].
* @public
* @extensions
*/
export interface ViewCreator3dOptions {
/** Turn the [[Camera]] on to produce a perspective view.
* Default: true
*/
cameraOn?: boolean;
/** Enables display of a [[SkyBox]] in the view. */
skyboxOn?: boolean;
/** Orients the view to one of the standard view rotations. */
standardViewId?: StandardViewId;
/** Merge in props from a persistent "seed" view obtained from the iModel.
* @note The selection of the seed view is somewhat arbitrary, and the contents and styling of that view are unpredictable, so this option is not recommended.
*/
useSeedView?: boolean;
/** The desired aspect ratio of the [[Viewport]] in which the view is to be displayed.
* This is used to adjust the view's frustum so that the viewed models are better centered within the viewport.
*/
vpAspect?: number;
/** Indicates that geometry belonging to every [SubCategory]($backend) should be visible within the view.
* Each subcategory has a [SubCategoryAppearance]($common) that specifies how its geometry is displayed. This includes a [SubCategoryAppearance.invisible]($common) property that,
* when set to `true`, indicates the geometry should not be displayed at all. A view can override the appearances of any subcategories using a [SubCategoryOverride]($common).
* If `allSubCategoriesVisible` is `true`, [[ViewCreator3d]] will apply such an override to every viewed subcategory to change [SubCategoryOverride.invisible]($common) to `false`, making
* every subcategory visible.
* @note Subcategories are typically set to invisible by default for a reason.
* Forcing them all to be visible may produce undesirable results, such as z-fighting between geometry on different subcategories that are not intended to be viewed together.
*/
allSubCategoriesVisible?: boolean;
}
/**
* API for creating a 3D default [[ViewState3d]] for an iModel. @see [[ViewCreator2d]] to create a view for a 2d model.
* Example usage:
* ```ts
* const viewCreator = new ViewCreator3d(imodel);
* const defaultView = await viewCreator.createDefaultView({skyboxOn: true});
* ```
* @public
* @extensions
*/
export declare class ViewCreator3d {
private _imodel;
/**
* Constructs a ViewCreator3d using an [[IModelConnection]].
* @param _imodel [[IModelConnection]] to query for categories and/or models.
*/
constructor(_imodel: IModelConnection);
/**
* Creates a default [[ViewState3d]] based on the model ids passed in. If no model ids are passed in, all 3D models in the iModel are used.
* @param [options] Options for creating the view.
* @param [modelIds] Ids of models to display in the view.
* @throws [IModelError]($common) If no 3d models are found in the iModel.
*/
createDefaultView(options?: ViewCreator3dOptions, modelIds?: Id64String[]): Promise<ViewState>;
/**
* Generates a view state props object for creating a view. Merges display styles with a seed view if the options.useSeedView is true
* @param models Models to put in view props
* @param options view creation options like camera On and skybox On
*/
private _createViewStateProps;
/**
* Merges a seed view in the iModel with the passed view state props. It will be a no-op if there are no default 3D views in the iModel
* @param viewStateProps Input view props to be merged
*/
private _mergeSeedView;
/**
* Get the Id of the default view.
*/
private _getDefaultViewId;
}
//# sourceMappingURL=ViewCreator3d.d.ts.map