@itwin/core-common
Version:
iTwin.js components common to frontend and backend
68 lines • 3.94 kB
TypeScript
/** @packageDocumentation
* @module Views
*/
import { Id64Array, Id64String } from "@itwin/core-bentley";
import { ClipVector, ClipVectorProps } from "@itwin/core-geometry";
/** JSON representation of a [[ModelClipGroup]].
* @public
* @extensions
*/
export interface ModelClipGroupProps {
/** The Ids of the models in the group. */
models?: Id64Array;
/** JSON representation of the [ClipVector]($core-geometry) applied to the group. */
clip?: ClipVectorProps;
}
/** Describes how to clip a group of models in the context of a [ViewDefinition3d]($backend) by applying a single [ClipVector]($core-geometry] to each model in the group.
* @see [[ModelClipGroups]] to define multiple groups of models with different clip vectors.
* @public
*/
export declare class ModelClipGroup {
/** The Ids of the models to be clipped, or undefined if the group includes all models. */
readonly models?: Id64Array;
/** The clip to apply to the group of models. `undefined` indicates the models are exempt from clipping. */
readonly clip?: ClipVector;
private constructor();
/** Create a new ModelClipGroup. The input arguments are captured as references and should not be subsequently modified. */
static create(clip: ClipVector | undefined, models?: Id64Array): ModelClipGroup;
/** Create a deep copy of this group. */
clone(): ModelClipGroup;
/** Returns whether the specified model Id belongs to this group. */
includesModel(modelId: Id64String): boolean;
/** Create from JSON representation. */
static fromJSON(props: ModelClipGroupProps): ModelClipGroup;
/** Convert to JSON representation. */
toJSON(): ModelClipGroupProps;
}
/** Describes how to clip groups of models in the context of a [ViewDefinition3d]($backend) or [ViewState3d]($frontend).
* Each group will be clipped by the [ClipVector]($core-geometry) associated with the group to which it belongs.
* A model belongs to the first group in the list for which `ModelClipGroup.includesModel()` returns `true`.
* A catch-all group can be defined by a ModelClipGroup with an `undefined` array of model Ids; any model whose Id does not appear in any group's list would belong to this group. If a catch-all group exists, it should appear last in the list.
* A group of models can be exempted from clipping by a ModelClipGroup with an `undefined` ClipVector.
* @note A ModelClipGroups obtained from a [[ViewDetails3d]] should **not** be modified directly. Clone it instead and modify the clone.
* @see [[ViewDetails3d.modelClipGroups]] to define the clip groups for a [ViewDefinition3d]($backend) or [ViewState3d]($frontend).
* @public
*/
export declare class ModelClipGroups {
/** The groups of models and their associated clips. */
readonly groups: ModelClipGroup[];
/** Create a new ModelClipGroups.
* @note The ModelClipGroup takes ownership of the input array, which should not be subsequently modified.
*/
constructor(groups?: ModelClipGroup[]);
/** Create a deep copy of this ModelClipGroups. */
clone(): ModelClipGroups;
/** Find the first group to which the specified model Id belongs, if any. */
findGroup(modelId: Id64String): ModelClipGroup | undefined;
/** Returns the array index of the group to which the specified model belongs, or -1 if the model belongs to no group. */
findGroupIndex(modelId: Id64String): number;
/** Find the clip that should be applied to the specified model.
* @note This may return `undefined` if the model belongs to no group, **or** it belongs to a group that should not be clipped.
*/
getClipForModel(modelId: Id64String): ClipVector | undefined;
/** Create from JSON representation. */
static fromJSON(props: ModelClipGroupProps[] | undefined): ModelClipGroups;
/** Convert to JSON representation. */
toJSON(): ModelClipGroupProps[];
}
//# sourceMappingURL=ModelClipGroup.d.ts.map