UnitFormattingSettingsProvider Interface

The UnitFormattingSettingsProvider interface is used to store and retrieve override FormatProps and Presentation Unit System for use by the QuantityFormatter. If no UnitFormattingSettingsProvider is supplied to the QuantityFormatter then any overrides set are lost when the session is closed. The ui-test-app has and example implementation that uses browser local storage via the class LocalUnitFormatProvider here.

Implemented by

Methods

Name Description
loadOverrides(imodel: undefined | IModelConnection): Promise<void> Function to load overrides for a specific IModelConnection.  
remove(quantityTypeKey: string): Promise<boolean> removes the override formats for a specific quantity type.  
retrieve(quantityTypeKey: string): Promise<undefined | OverrideFormatEntry> retrieves serialized JSON object containing format overrides for a specific quantity type.  
retrieveUnitSystem(defaultKey: UnitSystemKey): Promise<UnitSystemKey> retrieves the active unit system typically based on the "active" iModelConnection  
store(quantityTypeKey: string, overrideProps: OverrideFormatEntry): Promise<boolean> serializes JSON object containing format overrides for a specific quantity type.  
storeFormatOverrides(args: QuantityFormatOverridesChangedArgs): Promise<void> function called to save format overrides  
storeUnitSystemKey(unitSystemKey: UnitSystemKey): Promise<boolean> store the active unit system typically for the "active" iModelConnection  
storeUnitSystemSetting(args: FormattingUnitSystemChangedArgs): Promise<void> function called to save changes to Presentation Unit System  

Properties

Name Type Description
maintainOverridesPerIModel Readonly boolean property that is set by the implementation to inform the BaseUnitFormattingSettingsProvider if the provider  

Defined in

Last Updated: 30 November, 2023