UNPKG

@itwin/ecschema-metadata

Version:

ECObjects core concepts in typescript

40 lines 2.16 kB
/** @packageDocumentation * @module Metadata */ import { ISchemaLocater, SchemaContext } from "../Context"; import { BeEvent } from "@itwin/core-bentley"; import { FormatDefinition, FormatsChangedArgs, FormatsProvider, UnitSystemKey } from "@itwin/core-quantity"; /** * Provides default formats and kind of quantities from a given SchemaContext or SchemaLocater. * @beta */ export declare class SchemaFormatsProvider implements FormatsProvider { private _context; private _unitSystem; private _formatsRetrieved; onFormatsChanged: BeEvent<(args: FormatsChangedArgs) => void>; /** * * @param contextOrLocater The SchemaContext or a different ISchemaLocater implementation used to retrieve the schema. The SchemaContext * class implements the ISchemaLocater interface. If the provided locater is not a SchemaContext instance a new SchemaContext will be * created and the locater will be added. * @param unitSystem Used to lookup a default format through a schema specific algorithm, when the format retrieved is associated with a KindOfQuantity. */ constructor(contextOrLocater: ISchemaLocater, unitSystem: UnitSystemKey); get context(): SchemaContext; get unitSystem(): UnitSystemKey; set unitSystem(unitSystem: UnitSystemKey); private clear; /** When using a presentation unit from a KindOfQuantity, the label and description should come from the KindOfQuantity */ private convertToFormatDefinition; private getKindOfQuantityFormatFromSchema; /** * Retrieves a Format from a SchemaContext. If the format is part of a KindOfQuantity, the first presentation format in the KindOfQuantity that matches the current unit system will be retrieved. * If no presentation format matches the current unit system, the persistence unit format will be retrieved if it matches the current unit system. * Else, the default presentation format will be retrieved. * @param name The full name of the Format or KindOfQuantity. * @returns */ getFormat(name: string): Promise<FormatDefinition | undefined>; } //# sourceMappingURL=SchemaFormatsProvider.d.ts.map