UNPKG

@itwin/core-frontend

Version:
209 lines • 12.4 kB
/** @packageDocumentation * @module Rendering */ import { Id64Arg, Id64Set } from "@itwin/core-bentley"; import { ColorDef, EmphasizeElementsProps, FeatureAppearance, FeatureOverrideType } from "@itwin/core-common"; import { FeatureSymbology } from "./render/FeatureSymbology"; import { FeatureOverrideProvider } from "./FeatureOverrideProvider"; import { Viewport } from "./Viewport"; /** An implementation of [[FeatureOverrideProvider]] for emphasizing selected elements through simple color/transparency appearance overrides. * @public * @extensions */ export declare class EmphasizeElements implements FeatureOverrideProvider { private _defaultAppearance?; private _unanimatedAppearance?; private _emphasizeIsolated?; private _overrideAppearance?; private readonly _emphasizedAppearance; /** If true, all overridden and emphasized elements will also have the "emphasis" effect applied to them. This causes them to be hilited using the current [[Viewport.emphasisSettings]]. */ wantEmphasis: boolean; /** Establish active feature overrides to emphasize elements and apply color/transparency overrides. * @see [[Viewport.addFeatureOverrideProvider]] */ addFeatureOverrides(overrides: FeatureSymbology.Overrides, vp: Viewport): void; /** @internal */ protected createAppearanceFromKey(key: number): FeatureAppearance; /** Get override key from color and override type */ createOverrideKey(color: ColorDef, override: FeatureOverrideType): number | undefined; /** Get color and override type for the given key. */ getOverrideFromKey(key: number): { overrideType: FeatureOverrideType; color: ColorDef; }; /** Establish a default appearance to apply to elements without overrides. If changing the default appearance * without also calling overrideElements, an explicit refresh must be requested for the change to take effect. * @see [[Viewport.setFeatureOverrideProviderChanged]] */ get defaultAppearance(): FeatureAppearance | undefined; set defaultAppearance(appearance: FeatureAppearance | undefined); /** Establish a default appearance to apply to elements that are not animated by the view's [RenderSchedule.Script]($common). * @note If this is the only change made to EmphasizeElements, you must call [[Viewport.setFeatureOverrideProviderChanged]] for * the change to take immediate effect. * @see [[createDefaultAppearance]] to create an appearance suitable for de-emphasizing the non-animated elements. */ get unanimatedAppearance(): FeatureAppearance | undefined; set unanimatedAppearance(appearance: FeatureAppearance | undefined); /** Create default appearance to use for emphasizeElements when not supplied by caller. */ createDefaultAppearance(): FeatureAppearance; /** Get the IDs of the currently never drawn elements. */ getNeverDrawnElements(vp: Viewport): Id64Set | undefined; /** Get the IDs of the currently always drawn elements. */ getAlwaysDrawnElements(vp: Viewport): Id64Set | undefined; /** Get the IDs of the currently hidden elements. */ getHiddenElements(vp: Viewport): Id64Set | undefined; /** Get the IDs of the currently isolated elements. */ getIsolatedElements(vp: Viewport): Id64Set | undefined; /** Get the IDs of the currently emphasized isolated elements. */ getEmphasizedIsolatedElements(): Id64Set | undefined; /** Get the IDs of the currently emphasized elements. */ getEmphasizedElements(vp: Viewport): Id64Set | undefined; /** Get the map of current elements with color/transparency overrides. */ getOverriddenElements(): Map<number, Id64Set> | undefined; /** Get the IDs of current elements with the specified color/transparency override. */ getOverriddenElementsByKey(key: number): Id64Set | undefined; /** Clear never drawn elements. * @return false if nothing to clear. */ clearNeverDrawnElements(vp: Viewport): boolean; /** Clear always drawn elements. * @return false if nothing to clear. */ clearAlwaysDrawnElements(vp: Viewport): boolean; /** Clear hidden elements. * @return false if nothing to clear. */ clearHiddenElements(vp: Viewport): boolean; /** Clear isolated elements. * @return false if nothing to clear. */ clearIsolatedElements(vp: Viewport): boolean; /** Clear emphasized elements. * @return false if nothing to clear. */ clearEmphasizedElements(vp: Viewport): boolean; /** Clear emphasized isolated elements. * @return false if nothing to clear. */ clearEmphasizedIsolatedElements(vp: Viewport, setToAlwaysDrawn: boolean): boolean; /** Clear color/transparency overrides from elements. Removes all overrides when keyOrIds isn't supplied. * @param keyOrIds Specify a key value from [[EmphasizeElements.getOverriddenElements]] or [[EmphasizeElements.createOverrideKey]] * to remove a single color/transparency override for the corresponding elements or specify the IDs of elements to * remove any color/transparency override from. * @return false if nothing to clear. */ clearOverriddenElements(vp: Viewport, keyOrIds?: number | Id64Arg): boolean; /** @internal */ protected updateIdSet(ids: Id64Arg, replace: boolean, existingIds?: Id64Set): Id64Set | undefined; /** Set the element IDs to be never drawn. * @param ids The IDs of the elements to never draw. * @param vp The viewport. * @param replace true to replace currently hidden elements (if any) or false to add to the existing set. * @return true if overrides were changed. * @see [[Viewport.neverDrawn]] * @internal */ setNeverDrawnElements(ids: Id64Arg, vp: Viewport, replace?: boolean): boolean; /** Set the element IDs to be always drawn. * @param ids The IDs of the elements to always draw. * @param vp The viewport. * @param exclusive If true, *only* the specified elements will be drawn. * @param replace true to replace currently always drawn elements (if any) or false to add to the existing set. * @return true if overrides were changed. * @see [[Viewport.alwaysDrawn]] * @see [[Viewport.isAlwaysDrawnExclusive]] * @internal */ setAlwaysDrawnElements(ids: Id64Arg, vp: Viewport, exclusive?: boolean, replace?: boolean): boolean; /** Set the element IDs to be never drawn. * @param ids The IDs of the elements to never draw. * @param vp The viewport. * @param replace true to replace currently hidden elements (if any) or false to add to the existing set. * @return true if overrides were changed. * @see [[Viewport.neverDrawn]] */ hideElements(ids: Id64Arg, vp: Viewport, replace?: boolean): boolean; /** Set the currently selected elements to be never drawn. * @param vp The viewport. * @param replace true to replace currently hidden elements (if any) or false to add to the existing set. * @param clearSelection true to clear current selection after setting appearance override, false to leave selected. * @return true if overrides were changed. * @see [[Viewport.neverDrawn]] */ hideSelectedElements(vp: Viewport, replace?: boolean, clearSelection?: boolean): boolean; /** Set the element IDs to be always drawn exclusively. * @param ids The IDs of the elements to always draw. * @param vp The viewport. * @param replace true to replace currently isolated elements (if any) or false to add to the existing set. * @return true if overrides were changed. * @see [[Viewport.alwaysDrawn]] * @see [[Viewport.isAlwaysDrawnExclusive]] */ isolateElements(ids: Id64Arg, vp: Viewport, replace?: boolean): boolean; /** Set the currently selected elements to be always drawn exclusively. * @param vp The viewport. * @param replace true to replace currently isolated elements (if any) or false to add to the existing set. * @param clearSelection true to clear current selection after setting appearance override, false to leave selected. * @return true if overrides were changed. * @see [[Viewport.alwaysDrawn]] * @see [[Viewport.isAlwaysDrawnExclusive]] */ isolateSelectedElements(vp: Viewport, replace?: boolean, clearSelection?: boolean): boolean; /** Set the element IDs to be always drawn normally with all other elements in the view overridden to draw using a default appearance. * @param ids The IDs of the elements to always draw. * @param vp The viewport. * @param defaultAppearance Optional default appearance, uses non-locatable transparent grey if not specified. * @param replace true to replace currently overridden elements (if any) or false to add to the existing set. * @return true if overrides were changed. * @see [[Viewport.alwaysDrawn]] * @see [[Viewport.isAlwaysDrawnExclusive]] */ emphasizeElements(ids: Id64Arg, vp: Viewport, defaultAppearance?: FeatureAppearance, replace?: boolean): boolean; /** Set the currently selected elements to be always drawn normally with all other elements in the view overridden to draw using a default appearance. * @param vp The viewport. * @param defaultAppearance Optional default appearance, uses transparent grey if not specified. * @param replace true to replace currently overridden elements (if any) or false to add to the existing set. * @param clearSelection true to clear current selection after setting appearance override, false to leave selected. * @return true if overrides were changed. * @see [[Viewport.alwaysDrawn]] * @see [[Viewport.isAlwaysDrawnExclusive]] */ emphasizeSelectedElements(vp: Viewport, defaultAppearance?: FeatureAppearance, replace?: boolean, clearSelection?: boolean): boolean; /** Set the element IDs to display with a color/transparency override. * @param ids The IDs of the elements. * @param vp The viewport. * @param color ColorDef to specify override rgb and alpha. * @param override Whether to use color and alpha, only color, or only alpha from the supplied ColorDef. * @param replace true to replace currently overridden elements (if any) or false to add to the existing set. * @return true if overrides were changed. * @see [[Viewport.addFeatureOverrideProvider]] */ overrideElements(ids: Id64Arg, vp: Viewport, color: ColorDef, override?: FeatureOverrideType, replace?: boolean): boolean; /** Set the currently selected elements to display with a color/transparency override. * @param vp The viewport. * @param color ColorDef to specify override rgb and alpha. * @param override Whether to use color and alpha, only color, or only alpha from the supplied ColorDef. * @param replace true to replace currently overridden elements (if any) or false to add to the existing set. * @param clearSelection true to clear current selection after setting appearance override, false to leave selected. * @return true if overrides were changed. * @see [[Viewport.addFeatureOverrideProvider]] */ overrideSelectedElements(vp: Viewport, color: ColorDef, override?: FeatureOverrideType, replace?: boolean, clearSelection?: boolean): boolean; /** @return true if provider is currently overriding the display of any elements. */ isActive(vp: Viewport): boolean; /** Serialize to JSON representation. * @see [[EmphasizeElements.fromJSON]] */ toJSON(vp: Viewport): EmphasizeElementsProps; /** Initialize from JSON representation. * @see [[EmphasizeElements.toJSON]] */ fromJSON(props: EmphasizeElementsProps, vp: Viewport): boolean; /** Return the EmphasizeElements provider currently registered with the specified Viewport, if one is already registered. */ static get(vp: Viewport): EmphasizeElements | undefined; /** Return the EmphasizeElements provider currently registered with the specified Viewport, or register a new one and return it. */ static getOrCreate(vp: Viewport): EmphasizeElements; /** Drop the EmphasizeElements provider currently registered with the specified Viewport, if any is registered. */ static clear(vp: Viewport, inactiveOnly?: boolean): void; } //# sourceMappingURL=EmphasizeElements.d.ts.map