@itwin/core-backend
Version:
iTwin.js backend components
104 lines • 6.03 kB
TypeScript
/** @packageDocumentation
* @module ViewDefinitions
*/
import { Id64String } from "@itwin/core-bentley";
import { Code, CodeScopeProps, ColorDef, DisplayStyle3dProps, DisplayStyle3dSettings, DisplayStyle3dSettingsProps, DisplayStyleProps, DisplayStyleSettings, EntityReferenceSet, RenderSchedule, ViewFlags } from "@itwin/core-common";
import { DefinitionElement } from "./Element";
import { IModelDb } from "./IModelDb";
import { IModelElementCloneContext } from "./IModelElementCloneContext";
import { DeserializeEntityArgs, ECSqlRow } from "./Entity";
/** A DisplayStyle defines the parameters for 'styling' the contents of a view.
* Internally a DisplayStyle consists of a dictionary of several named 'styles' describing specific aspects of the display style as a whole.
* Many ViewDefinitions may share the same DisplayStyle.
* @public @preview
*/
export declare abstract class DisplayStyle extends DefinitionElement {
static get className(): string;
abstract get settings(): DisplayStyleSettings;
protected constructor(props: DisplayStyleProps, iModel: IModelDb);
/** @beta */
static deserialize(props: DeserializeEntityArgs): DisplayStyleProps;
/** @beta */
static serialize(props: DisplayStyleProps, iModel: IModelDb): ECSqlRow;
/** Create a Code for a DisplayStyle given a name that is meant to be unique within the scope of the specified DefinitionModel.
* @param iModel The IModelDb
* @param scopeModelId The Id of the DefinitionModel that contains the DisplayStyle and provides the scope for its name.
* @param codeValue The DisplayStyle name
*/
static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code;
protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
/** @alpha */
protected static onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyleProps, targetElementProps: DisplayStyleProps): void;
loadScheduleScript(): RenderSchedule.ScriptReference | undefined;
}
/** A DisplayStyle for 2d views.
* @public @preview
*/
export declare class DisplayStyle2d extends DisplayStyle {
static get className(): string;
private readonly _settings;
get settings(): DisplayStyleSettings;
protected constructor(props: DisplayStyleProps, iModel: IModelDb);
/** Create a DisplayStyle2d for use by a ViewDefinition.
* @param iModelDb The iModel
* @param definitionModelId The [[DefinitionModel]]
* @param name The name/CodeValue of the DisplayStyle2d
* @returns The newly constructed DisplayStyle2d element.
* @throws [[IModelError]] if unable to create the element.
*/
static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string): DisplayStyle2d;
/** Insert a DisplayStyle2d for use by a ViewDefinition.
* @param iModelDb Insert into this iModel
* @param definitionModelId Insert the new DisplayStyle2d into this DefinitionModel
* @param name The name of the DisplayStyle2d
* @returns The Id of the newly inserted DisplayStyle2d element.
* @throws [[IModelError]] if unable to insert the element.
*/
static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string): Id64String;
}
/** Describes initial settings for a new [[DisplayStyle3d]].
* Most properties are inherited from [DisplayStyle3dSettingsProps]($common), but for backwards compatibility reasons, this interface is slightly awkward:
* - It adds a `viewFlags` member that differs only in case and type from [DisplayStyleSettingsProps.viewflags]($common); and
* - It extends the type of [DisplayStyleSettingsProps.backgroundColor]($common) to include [ColorDef]($common).
* These idiosyncrasies will be addressed in a future version of core-backend.
* @see [[DisplayStyle3d.create]].
* @public @preview
*/
export interface DisplayStyleCreationOptions extends Omit<DisplayStyle3dSettingsProps, "backgroundColor" | "scheduleScript"> {
/** If supplied, the [ViewFlags]($common) applied by the display style.
* If undefined, [DisplayStyle3dSettingsProps.viewflags]($common) will be used if present (note the difference in case); otherwise, default-constructed [ViewFlags]($common) will be used.
*/
viewFlags?: ViewFlags;
backgroundColor?: ColorDef | number;
}
/** A DisplayStyle for 3d views.
* See [how to create a DisplayStyle3d]$(docs/learning/backend/CreateElements.md#DisplayStyle3d).
* @public @preview
*/
export declare class DisplayStyle3d extends DisplayStyle {
static get className(): string;
private readonly _settings;
get settings(): DisplayStyle3dSettings;
protected constructor(props: DisplayStyle3dProps, iModel: IModelDb);
protected collectReferenceIds(referenceIds: EntityReferenceSet): void;
/** @alpha */
protected static onCloned(context: IModelElementCloneContext, sourceElementProps: DisplayStyle3dProps, targetElementProps: DisplayStyle3dProps): void;
/** Create a DisplayStyle3d for use by a ViewDefinition.
* @param iModelDb The iModel
* @param definitionModelId The [[DefinitionModel]]
* @param name The name/CodeValue of the DisplayStyle3d
* @returns The newly constructed DisplayStyle3d element.
* @throws [[IModelError]] if unable to create the element.
*/
static create(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): DisplayStyle3d;
/**
* Insert a DisplayStyle3d for use by a ViewDefinition.
* @param iModelDb Insert into this iModel
* @param definitionModelId Insert the new DisplayStyle3d into this [[DefinitionModel]]
* @param name The name of the DisplayStyle3d
* @returns The Id of the newly inserted DisplayStyle3d element.
* @throws [[IModelError]] if unable to insert the element.
*/
static insert(iModelDb: IModelDb, definitionModelId: Id64String, name: string, options?: DisplayStyleCreationOptions): Id64String;
}
//# sourceMappingURL=DisplayStyle.d.ts.map