@itwin/ecschema-metadata
Version:
ECObjects core concepts in typescript
73 lines • 3.65 kB
TypeScript
import { UnitConversionProps, UnitExtraData, UnitProps, UnitsProvider } from "@itwin/core-quantity";
import { ISchemaLocater } from "../Context";
/**
* Class used to find Units in SchemaContext by attributes such as Phenomenon and DisplayLabel.
* @beta
*/
export declare class SchemaUnitProvider implements UnitsProvider {
private _unitExtraData;
private _unitConverter;
private _context;
/**
*
* @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 _unitExtraData Additional data like alternate display label not found in Units Schema to match with Units; Defaults to empty array.
*/
constructor(contextOrLocater: ISchemaLocater, _unitExtraData?: UnitExtraData[]);
/**
* Find unit in a schema that has unitName.
* @param unitName Full name of unit.
* @returns UnitProps interface from @itwin/core-quantity whose name matches unitName.
*/
findUnitByName(unitName: string): Promise<UnitProps>;
/**
* Find all units in context that belongs to given phenomenon.
* @param phenomenon Full name of phenomenon.
* @returns Array of UnitProps (from @itwin/core-quantity) interface objects whose name matches phenomenon param.
*/
getUnitsByFamily(phenomenon: string): Promise<Array<UnitProps>>;
/**
* Find alternate display labels associated with unitName, if any.
* @param unitName Full name of Unit.
*/
getAlternateDisplayLabels(unitName: string): Array<string>;
/**
* Finds Unit by unitLabel, which could be a display label in the schema or alternate an display label defined in
* this._unitExtraData. If there are duplicates of the same display label in the context or teh same alternate display
* labels, specify schemaName, phenomenon, or unitSystem to get a specific unit.
*
* @param unitLabel Display label or alternate display label to query unit by.
* @param schemaName Ensure Unit with unitLabel belongs to Schema with schemaName.
* @param phenomenon Full name of phenomenon that Unit belongs to.
* @param unitSystem Full name of unitSystem that Unit belongs to.
* @returns The UnitProps interface from the @itwin/core-quantity package.
*/
findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps>;
/**
* Gets the @itwin/core-quantity UnitConversionProps for the given fromUnit and toUnit.
* @param fromUnit The UnitProps of the 'from' unit.
* @param toUnit The UnitProps of the 'to' unit.
* @returns The UnitConversionProps interface from the @itwin/core-quantity package.
*/
getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps>;
private checkUnitPropsForConversion;
/**
* Gets the @itwin/core UnitProps for the given Unit.
* @param unit The Unit to convert.
* @returns UnitProps interface from @itwin/core.
*/
private getUnitsProps;
/**
* Finds Unit by displayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.
* @internal
*/
private findUnitByDisplayLabel;
/**
* Finds Unit by altDisplayLabel and that it belongs to schemaName, phenomenon, and unitSystem if defined.
* @internal
*/
private findUnitByAltDisplayLabel;
}
//# sourceMappingURL=SchemaUnitProvider.d.ts.map