UNPKG

@itwin/core-frontend

Version:
76 lines 5.05 kB
/** @packageDocumentation * @module Rendering */ import { BeEvent } from "@itwin/core-bentley"; import { FeatureOverrides } from "@itwin/core-common"; import { Viewport } from "../Viewport"; import { ViewState } from "../ViewState"; /** Contains types that enable an application to customize how [Feature]($common)s are drawn within a [[Viewport]]. * @public * @extensions */ export declare namespace FeatureSymbology { /** An object that serves as the source of a [[FeatureSymbology.Overrides]]. * Use this if you are drawing the same tiles into a single Viewport and overriding the FeatureSymbology.Overrides applied to them * by settings [[GraphicBranch.symbologyOverrides]]. * Each tile will have a separate set of feature overrides per combination of Source and Viewport. This prevents the display system * from constantly recomputing the feature overrides for a tile. * You must call `onSourceDisposed.raiseEvent()` when the source is no longer being used by the Viewport to allow the feature overrides * and their WebGL resources to be freed - failure to do so will result in memory leaks, which may eventually produce WebGL context loss. * @alpha */ interface Source { /** An event raised when this source becomes disassociated with the viewport, indicating any WebGL resources allocated for it * can be freed. * Failure to invoke this event appropriately will result in memory leaks, which may eventually produce WebGL context loss. */ readonly onSourceDisposed: BeEvent<() => void>; } /** Allows a [[Viewport]] to customize the appearance of individual [Feature]($common)s within it. * * The Viewport computes its base Overrides based on the following: * - The set of categories enabled for display in its [[CategorySelectorState]]. Every [[SubCategory]] belonging to an enabled [[Category]] is added to the set of visible subcategories - all other subcategories are assumed to be invisible. * - For the set of visible subcategories, any [[SubCategoryOverride]]s defined by the view's [[DisplayStyleState]] are applied. This may render some subcategories invisible, and change the symbology of others. * - The visibility of each [GeometryClass]($common) is set based on the view's [ViewFlags]($common). * - The line weight is overridden to 1 pixel for all Features if line weight has been disabled by the view's [ViewFlags]($common). * - The sets of elements which are always drawn and never drawn are initialized from the [[Viewport]]'s sets. * An application can further customize the symbology of any Features by registering a [[FeatureOverrideProvider]] with a [[Viewport]]. That provider's addFeatureOverrides function will be invoked * whenever the Overrides need to be regenerated. * * To override the symbology of *most* Features within a view, specify a `defaultOverrides` to be applied to any Feature not explicitly overridden. * If default overrides are defined and some Features should draw normally without being affected by the default overrides, override that Feature with * an Appearance which defines no overrides. * * It is possible to override multiple aspects of a Feature. For example, you might specify that all elements belonging to subcategory "A" should be drawn in red, and * that the element with Id "0x123" should be drawn with 0.25 transparency. In this case, when drawing a Feature with subcategory "A" and element Id "0x123", the two overrides will * be merged, causing the Feature's geometry to draw 25% transparent red. On the other hand, if subcategory "A" is specified to draw in red and element "0x123" to draw in green, * the color specified by the element override will take precedence over that specified for the subcategory, resulting in a green Feature. * * @see [[Viewport.alwaysDrawn]] * @see [[Viewport.neverDrawn]] */ class Overrides extends FeatureOverrides { private _source?; /** @alpha */ get source(): Source | undefined; /** Construct a new Overrides. The result is an empty set of overrides if no view or viewport is supplied. * @param view If supplied, the overrides will be initialized based on the current state of the view or viewport. */ constructor(view?: ViewState | Viewport); /** Create symbology overrides associated with a [[FeatureSymbology.Source]]. * @alpha */ static withSource(source: Source, view?: ViewState | Viewport): Overrides; /** Initialize these Overrides based on a specific view. * @internal */ initFromView(view: ViewState): void; /** Initialize these Overrides based on a specific viewport. * @internal */ initFromViewport(viewport: Viewport): void; private _initFromView; private _initSubCategoryOverrides; } } //# sourceMappingURL=FeatureSymbology.d.ts.map