@itwin/core-frontend
Version:
iTwin.js frontend components
124 lines • 7.25 kB
TypeScript
/** @packageDocumentation
* @module Views
*/
import { BeEvent, Id64String, OrderedId64Iterable } from "@itwin/core-bentley";
import { Matrix3d, Range3d, XYAndZ } from "@itwin/core-geometry";
import { AxisAlignedBox3d, HydrateViewStateRequestProps, HydrateViewStateResponseProps, SpatialViewDefinitionProps, ViewStateProps } from "@itwin/core-common";
import { AuxCoordSystemState } from "./AuxCoordSys";
import { ModelSelectorState } from "./ModelSelectorState";
import { CategorySelectorState } from "./CategorySelectorState";
import { DisplayStyle3dState } from "./DisplayStyleState";
import { GeometricModelState } from "./ModelState";
import { SceneContext } from "./ViewContext";
import { IModelConnection } from "./IModelConnection";
import { AttachToViewportArgs, ViewState3d } from "./ViewState";
import { TileTreeReference } from "./tile/internal";
/** Options supplied to [[SpatialViewState.computeFitRange]].
* @public
*/
export interface ComputeSpatialViewFitRangeOptions {
/** The minimal extents. The computed range will be unioned with this range if supplied. */
baseExtents?: Range3d;
}
/** Defines a view of one or more SpatialModels.
* The list of viewed models is stored in the ModelSelector.
* @public
* @extensions
*/
export declare class SpatialViewState extends ViewState3d {
static get className(): string;
private readonly _treeRefs;
private _modelSelector;
private readonly _unregisterModelSelectorListeners;
/** An event raised when the set of models viewed by this view changes, *only* if the view is attached to a [[Viewport]].
* @public
*/
readonly onViewedModelsChanged: BeEvent<() => void>;
get modelSelector(): ModelSelectorState;
set modelSelector(selector: ModelSelectorState);
/** Create a new *blank* SpatialViewState. The returned SpatialViewState will nave non-persistent empty [[CategorySelectorState]] and [[ModelSelectorState]],
* and a non-persistent [[DisplayStyle3dState]] with default values for all of its components. Generally after creating a blank SpatialViewState,
* callers will modify the state to suit specific needs.
* @param iModel The IModelConnection for the new SpatialViewState
* @param origin The origin for the new SpatialViewState
* @param extents The extents for the new SpatialViewState
* @param rotation The rotation of the new SpatialViewState. If undefined, use top view.
* @public
*/
static createBlank(iModel: IModelConnection, origin: XYAndZ, extents: XYAndZ, rotation?: Matrix3d): SpatialViewState;
static createFromProps(props: ViewStateProps, iModel: IModelConnection): SpatialViewState;
toProps(): ViewStateProps;
constructor(props: SpatialViewDefinitionProps, iModel: IModelConnection, arg3: CategorySelectorState, displayStyle: DisplayStyle3dState, modelSelector: ModelSelectorState);
isSpatialView(): this is SpatialViewState;
equals(other: this): boolean;
createAuxCoordSystem(acsName: string): AuxCoordSystemState;
get defaultExtentLimits(): {
min: number;
max: number;
};
/** @internal */
markModelSelectorChanged(): void;
private computeBaseExtents;
/** Compute a volume in world coordinates tightly encompassing the contents of the view. The volume is computed from the union of the volumes of the
* view's viewed models, including [GeometricModel]($backend)s and reality models.
* Those volumes are obtained from the [[TileTree]]s used to render those models, so any tile tree that has not yet been loaded will not contribute to the computation.
* If `options.baseExtents` is defined, it will be unioned with the computed volume.
* If the computed volume is null (empty), a default volume will be computed from [IModel.projectExtents]($common), which may be a looser approximation of the
* models' volumes.
* @param options Options used to customize how the volume is computed.
* @returns A non-null volume in world coordinates encompassing the contents of the view.
*/
computeFitRange(options?: ComputeSpatialViewFitRangeOptions): AxisAlignedBox3d;
getViewedExtents(): AxisAlignedBox3d;
toJSON(): SpatialViewDefinitionProps;
/** @internal */
protected preload(hydrateRequest: HydrateViewStateRequestProps): void;
/** @internal */
protected postload(hydrateResponse: HydrateViewStateResponseProps): Promise<void>;
viewsModel(modelId: Id64String): boolean;
clearViewedModels(): void;
addViewedModel(id: Id64String): void;
removeViewedModel(id: Id64String): void;
forEachModel(func: (model: GeometricModelState) => void): void;
/** @internal */
getModelTreeRefs(): Iterable<TileTreeReference>;
/** @internal */
createScene(context: SceneContext): void;
/** See [[ViewState.attachToViewport]]. */
attachToViewport(args: AttachToViewportArgs): void;
/** See [[ViewState.detachFromViewport]]. */
detachFromViewport(): void;
/** Chiefly for debugging: change the "deactivated" state of one or more tile tree references. Deactivated references are
* omitted when iterating the references, so e.g. their graphics are omitted from the scene.
* @param modelIds The Ids of one or more models whose tile tree references are to be affected. If omitted, all models are affected.
* @param deactivated True to deactivate the specified references, false to reactivate them, undefined to invert each one's current state.
* @param which The references to be affected as either a broad category or one or more indices of animated references.
* @internal
*/
setTileTreeReferencesDeactivated(modelIds: Id64String | Id64String[] | undefined, deactivated: boolean | undefined, which: "all" | "animated" | "primary" | "section" | number[]): void;
/** For getting the [TileTreeReference]s that are in the modelIds, for planar classification.
* @param modelIds modelIds for which to get the TileTreeReferences
* @param maskTreeRefs where to store the TileTreeReferences
* @param maskRange range to extend for the maskRefs
* @internal
*/
collectMaskRefs(modelIds: OrderedId64Iterable, maskTreeRefs: TileTreeReference[], maskRange: Range3d): void;
/** For getting a list of modelIds which do not participate in masking for planar classification.
* @param maskModels models which DO participate in planar clip masking
* @param useVisible when true, use visible models to set flag
* @internal
*/
getModelsNotInMask(maskModels: OrderedId64Iterable | undefined, useVisible: boolean): Id64String[] | undefined;
private registerModelSelectorListeners;
private unregisterModelSelectorListeners;
}
/** Defines a spatial view that displays geometry on the image plane using a parallel orthographic projection.
* @public
* @extensions
*/
export declare class OrthographicViewState extends SpatialViewState {
static get className(): string;
constructor(props: SpatialViewDefinitionProps, iModel: IModelConnection, categories: CategorySelectorState, displayStyle: DisplayStyle3dState, modelSelector: ModelSelectorState);
supportsCamera(): boolean;
}
//# sourceMappingURL=SpatialViewState.d.ts.map