UNPKG

@itwin/ecschema-metadata

Version:

ECObjects core concepts in typescript

80 lines 3.25 kB
/** @packageDocumentation * @module Metadata */ import { SchemaItemUnitProps } from "../Deserialization/JsonProps"; import { SchemaItemType } from "../ECObjects"; import { LazyLoadedPhenomenon, LazyLoadedUnitSystem } from "../Interfaces"; import { Schema } from "./Schema"; import { SchemaItem } from "./SchemaItem"; /** * An abstract class that adds the ability to define Units and everything that goes with them, within an ECSchema as a * first-class concept is to allow the iModel to not be dependent on any hard-coded Units * @public @preview */ export declare class Unit extends SchemaItem { readonly schemaItemType: SchemaItemType; /** @internal */ static get schemaItemType(): SchemaItemType; private _phenomenon?; private _unitSystem?; private _definition; private _numerator?; private _denominator?; private _offset?; /** @internal */ constructor(schema: Schema, name: string); get phenomenon(): LazyLoadedPhenomenon | undefined; get unitSystem(): LazyLoadedUnitSystem | undefined; get definition(): string; get numerator(): number; get offset(): number; get denominator(): number; get hasNumerator(): boolean; get hasOffset(): boolean; get hasDenominator(): boolean; /** * Returns true if a conversion can be calculated between the input units * @alpha */ static areCompatible(unitA: Unit, unitB: Unit): Promise<boolean>; /** * Type guard to check if the SchemaItem is of type Unit. * @param item The SchemaItem to check. * @returns True if the item is a Unit, false otherwise. */ static isUnit(item?: SchemaItem): item is Unit; /** * Save this Unit's properties to an object for serializing to JSON. * @param standalone Serialization includes only this object (as opposed to the full schema). * @param includeSchemaVersion Include the Schema's version information in the serialized object. */ toJSON(standalone?: boolean, includeSchemaVersion?: boolean): SchemaItemUnitProps; /** @internal */ toXml(schemaXml: Document): Promise<Element>; fromJSONSync(unitProps: SchemaItemUnitProps): void; fromJSON(unitProps: SchemaItemUnitProps): Promise<void>; /** @internal */ protected setPhenomenon(phenomenon: LazyLoadedPhenomenon): Promise<void>; /** @internal */ protected setUnitSystem(unitSystem: LazyLoadedUnitSystem): Promise<void>; /** @internal */ protected setDefinition(definition: string): Promise<void>; /** * Type assertion to check if the SchemaItem is of type Unit. * @param item The SchemaItem to check. * @returns The item cast to Unit if it is a Unit, undefined otherwise. * @internal */ static assertIsUnit(item?: SchemaItem): asserts item is Unit; } /** * @internal * An abstract class used for schema editing. */ export declare abstract class MutableUnit extends Unit { abstract setPhenomenon(phenomenon: LazyLoadedPhenomenon): Promise<void>; abstract setUnitSystem(unitSystem: LazyLoadedUnitSystem): Promise<void>; abstract setDefinition(definition: string): Promise<void>; abstract setDisplayLabel(displayLabel: string): void; } //# sourceMappingURL=Unit.d.ts.map