@itwin/core-frontend 5.4.0-dev.6 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/lib/cjs/IModelApp.d.ts +12 -0
  3. package/lib/cjs/IModelApp.d.ts.map +1 -1
  4. package/lib/cjs/IModelApp.js +9 -0
  5. package/lib/cjs/IModelApp.js.map +1 -1
  6. package/lib/cjs/IModelConnection.d.ts.map +1 -1
  7. package/lib/cjs/IModelConnection.js +6 -2
  8. package/lib/cjs/IModelConnection.js.map +1 -1
  9. package/lib/cjs/SheetViewState.d.ts +7 -5
  10. package/lib/cjs/SheetViewState.d.ts.map +1 -1
  11. package/lib/cjs/SheetViewState.js +52 -683
  12. package/lib/cjs/SheetViewState.js.map +1 -1
  13. package/lib/cjs/internal/SheetViewAttachments.d.ts +57 -0
  14. package/lib/cjs/internal/SheetViewAttachments.d.ts.map +1 -0
  15. package/lib/cjs/internal/SheetViewAttachments.js +336 -0
  16. package/lib/cjs/internal/SheetViewAttachments.js.map +1 -0
  17. package/lib/cjs/internal/ViewAttachmentRenderer.d.ts +32 -0
  18. package/lib/cjs/internal/ViewAttachmentRenderer.d.ts.map +1 -0
  19. package/lib/cjs/internal/ViewAttachmentRenderer.js +462 -0
  20. package/lib/cjs/internal/ViewAttachmentRenderer.js.map +1 -0
  21. package/lib/cjs/internal/render/webgl/SceneCompositor.js +1 -1
  22. package/lib/cjs/internal/render/webgl/SceneCompositor.js.map +1 -1
  23. package/lib/cjs/internal/render/webgl/ShaderBuilder.d.ts.map +1 -1
  24. package/lib/cjs/internal/render/webgl/ShaderBuilder.js +8 -1
  25. package/lib/cjs/internal/render/webgl/ShaderBuilder.js.map +1 -1
  26. package/lib/cjs/properties/AngleDescription.js +4 -4
  27. package/lib/cjs/properties/AngleDescription.js.map +1 -1
  28. package/lib/cjs/properties/LengthDescription.js +9 -9
  29. package/lib/cjs/properties/LengthDescription.js.map +1 -1
  30. package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
  31. package/lib/cjs/quantity-formatting/QuantityFormatter.js +9 -8
  32. package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
  33. package/lib/cjs/tools/EventController.js +1 -1
  34. package/lib/cjs/tools/EventController.js.map +1 -1
  35. package/lib/cjs/tools/MeasureTool.js +21 -21
  36. package/lib/cjs/tools/MeasureTool.js.map +1 -1
  37. package/lib/esm/IModelApp.d.ts +12 -0
  38. package/lib/esm/IModelApp.d.ts.map +1 -1
  39. package/lib/esm/IModelApp.js +9 -0
  40. package/lib/esm/IModelApp.js.map +1 -1
  41. package/lib/esm/IModelConnection.d.ts.map +1 -1
  42. package/lib/esm/IModelConnection.js +7 -3
  43. package/lib/esm/IModelConnection.js.map +1 -1
  44. package/lib/esm/SheetViewState.d.ts +7 -5
  45. package/lib/esm/SheetViewState.d.ts.map +1 -1
  46. package/lib/esm/SheetViewState.js +55 -686
  47. package/lib/esm/SheetViewState.js.map +1 -1
  48. package/lib/esm/internal/SheetViewAttachments.d.ts +57 -0
  49. package/lib/esm/internal/SheetViewAttachments.d.ts.map +1 -0
  50. package/lib/esm/internal/SheetViewAttachments.js +332 -0
  51. package/lib/esm/internal/SheetViewAttachments.js.map +1 -0
  52. package/lib/esm/internal/ViewAttachmentRenderer.d.ts +32 -0
  53. package/lib/esm/internal/ViewAttachmentRenderer.d.ts.map +1 -0
  54. package/lib/esm/internal/ViewAttachmentRenderer.js +459 -0
  55. package/lib/esm/internal/ViewAttachmentRenderer.js.map +1 -0
  56. package/lib/esm/internal/render/webgl/SceneCompositor.js +1 -1
  57. package/lib/esm/internal/render/webgl/SceneCompositor.js.map +1 -1
  58. package/lib/esm/internal/render/webgl/ShaderBuilder.d.ts.map +1 -1
  59. package/lib/esm/internal/render/webgl/ShaderBuilder.js +8 -1
  60. package/lib/esm/internal/render/webgl/ShaderBuilder.js.map +1 -1
  61. package/lib/esm/properties/AngleDescription.js +4 -4
  62. package/lib/esm/properties/AngleDescription.js.map +1 -1
  63. package/lib/esm/properties/LengthDescription.js +9 -9
  64. package/lib/esm/properties/LengthDescription.js.map +1 -1
  65. package/lib/esm/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
  66. package/lib/esm/quantity-formatting/QuantityFormatter.js +9 -8
  67. package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
  68. package/lib/esm/tools/EventController.js +1 -1
  69. package/lib/esm/tools/EventController.js.map +1 -1
  70. package/lib/esm/tools/MeasureTool.js +21 -21
  71. package/lib/esm/tools/MeasureTool.js.map +1 -1
  72. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  73. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  74. package/package.json +21 -21
@@ -1 +1 @@
1
- {"version":3,"file":"QuantityFormatter.js","sourceRoot":"","sources":["../../../src/quantity-formatting/QuantityFormatter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsGH,gDAKC;AAgDD,wEAEC;AA3JD,sDAA+E;AAC/E,wDAG8B;AAC9B,6EAA0E;AAC1E,4CAAyC;AAEzC,6DAAyF;AAGzF,oEAAoE;AAEpE;;;GAGG;AACH,IAAY,YAmBX;AAnBD,WAAY,YAAY;IACtB,6HAA6H;IAC7H,mDAAU,CAAA;IACV,8IAA8I;IAC9I,iDAAS,CAAA;IACT,wIAAwI;IACxI,+CAAQ,CAAA;IACR,8IAA8I;IAC9I,mDAAU,CAAA;IACV,4JAA4J;IAC5J,qDAAW,CAAA;IACX,yIAAyI;IACzI,2DAAc,CAAA;IACd,wIAAwI;IACxI,2DAAc,CAAA;IACd,kJAAkJ;IAClJ,+DAAgB,CAAA;IAChB,gJAAgJ;IAChJ,yEAAqB,CAAA;AACvB,CAAC,EAnBW,YAAY,4BAAZ,YAAY,QAmBvB;AA+BD;;;;GAIG;AACH,MAAa,2BAA2B;IAC9B,uBAAuB,GAAG,IAAI,GAAG,EAA4B,CAAC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B,EAAE,eAAe,CAAC;YACjD,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,SAAS;SAChB;KACF;IACD;QACE,GAAG,EAAE,gCAAgC;QACrC,WAAW,EAAE,8CAA8C;QAC3D,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;aAC1D;YACD,YAAY,EAAE,CAAC,gBAAgB,EAAE,eAAe,CAAC;YACjD,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormatting\r\n */\r\n\r\nimport { BeEvent, BentleyError, BeUiEvent, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n AlternateUnitLabelsProvider, Format, FormatDefinition, FormatProps, FormatsChangedArgs, FormatsProvider, FormatterSpec, ParseError, ParserSpec, QuantityParseResult,\r\n UnitConversionProps, UnitProps, UnitsProvider, UnitSystemKey,\r\n} from \"@itwin/core-quantity\";\r\nimport { FrontendLoggerCategory } from \"../common/FrontendLoggerCategory\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { BasicUnitsProvider, getDefaultAlternateUnitLabels } from \"./BasicUnitsProvider\";\r\nimport { CustomFormatPropEditorSpec } from \"./QuantityTypesEditorSpecs\";\r\n\r\n// cSpell:ignore FORMATPROPS FORMATKEY ussurvey uscustomary USCUSTOM\r\n\r\n/**\r\n * Defines standard format types for tools that need to display measurements to user.\r\n * @public\r\n */\r\nexport enum QuantityType {\r\n /** Length which is stored in meters. Typically formatted to display in meters or feet-inches based on active unit system. */\r\n Length = 1,\r\n /** Angular value which is stored in radians. Typically formatted to display degrees or Degrees-Minute-Seconds based on active unit system. */\r\n Angle = 2,\r\n /** Area value store in meters squared. Typically formatted to display in meters squared or feet squared based on active unit system. */\r\n Area = 3,\r\n /** Volume value which is stored in meters cubed. Typically formatted to display in meters cubed or feet cubed based on active unit system. */\r\n Volume = 4,\r\n /** LatLong is an angular value which is stored in radians. Typically formatted to display degrees or Degrees-Minute-Seconds based on active unit system. */\r\n LatLong = 5,\r\n /** Coordinate/Location value which is stored in meters. Typically formatted to display in meters or feet based on active unit system. */\r\n Coordinate = 6,\r\n /** Stationing is a distance value stored in meters. Typically formatted to display `xxx+xx` or `xx+xxx` based on active unit system. */\r\n Stationing = 7,\r\n /** LengthSurvey is a distance value stored in meters. Typically formatted to display in meters or US Survey Feet based on active unit system.. */\r\n LengthSurvey = 8,\r\n /** LengthEngineering is a distance value stored in meters. Typically formatted to display either meters or feet based on active unit system. */\r\n LengthEngineering = 9\r\n}\r\n\r\n/**\r\n * Used to uniquely identify the type or quantity. [[QuantityType]] are built-in types and `string` are used for custom quantity types.\r\n * @public\r\n */\r\nexport type QuantityTypeArg = QuantityType | string;\r\n\r\n/** String used to uniquely identify a QuantityType in the quantity registry. See function [[QuantityType.getQuantityTypeKey]].\r\n * @public\r\n */\r\nexport type QuantityTypeKey = string;\r\n\r\n/** String used to uniquely identify a UnitProp.\r\n * @public\r\n */\r\nexport type UnitNameKey = string;\r\n\r\n/**\r\n * Interface for the properties required to create a FormatterSpec or ParserSpec.\r\n * @beta\r\n */\r\nexport interface CreateFormattingSpecProps {\r\n /** The name of the persistence unit. */\r\n persistenceUnitName: string;\r\n /** The format properties to use for the spec. */\r\n formatProps: FormatProps;\r\n /** Optional name for the format. */\r\n formatName?: string;\r\n}\r\n\r\n/**\r\n * Class that contains alternate Unit Labels. These labels are used when parsing strings to quantities.\r\n * One use case is to allow a \"^\", which is easily input, to be used to specify \"°\".\r\n * @internal\r\n */\r\nexport class AlternateUnitLabelsRegistry implements AlternateUnitLabelsProvider {\r\n private _alternateLabelRegistry = new Map<UnitNameKey, Set<string>>();\r\n\r\n public addAlternateLabels(key: UnitNameKey, ...labels: string[]) {\r\n [...labels].forEach((value) => this._alternateLabelRegistry.get(key)?.add(value));\r\n }\r\n\r\n constructor(defaultAlternates?: Map<UnitNameKey, Set<string>>) {\r\n if (defaultAlternates) {\r\n this._alternateLabelRegistry = defaultAlternates;\r\n }\r\n }\r\n\r\n public getAlternateUnitLabels(unit: UnitProps): string[] | undefined {\r\n const key: UnitNameKey = unit.name;\r\n const labels = this._alternateLabelRegistry.get(key);\r\n if (labels)\r\n return [...labels.values()];\r\n\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Function to return a QuantityTypeKey given either a QuantityType enum value or a string. This allows caching and\r\n * retrieving standard and custom quantity types.\r\n * @public\r\n */\r\nexport function getQuantityTypeKey(type: QuantityTypeArg): QuantityTypeKey {\r\n // For QuantityType enum values, build a string that shouldn't collide with anything a user may come up with\r\n if (typeof type === \"number\")\r\n return `QuantityTypeEnumValue-${type.toString()}`;\r\n return type;\r\n}\r\n\r\n/**\r\n * This interface supplies the definition of a `standard` quantity type that is registered with the QuantityFormatter.\r\n * A `standard` quantity type could be one of the nine delivered QuantityTypes or a CustomQuantityTypeDefinition.\r\n * @public\r\n */\r\nexport interface QuantityTypeDefinition {\r\n /** String used as a key to look up the quantity type. If defining a [[CustomQuantityTypeDefinition]] the QuantityTypeKey\r\n * should match the QuantityTypeArg. */\r\n readonly key: QuantityTypeKey;\r\n /** The type value which can be one of the standard QuantityType enum values or a unique string if defining a custom type. */\r\n readonly type: QuantityTypeArg;\r\n /** The unit that the magnitude of the quantity is stored ie. (Meter for Length and Radian for Angle). The persistence unit is\r\n * also used during formatting if the FormatProps does not define one or more composite units. */\r\n readonly persistenceUnit: UnitProps;\r\n /** Localized label to display in UI */\r\n label: string;\r\n /** Localized description that may be used to provide detailed description for the Quantity type. */\r\n description: string;\r\n /* Provide a default FormatProps for a unit system. */\r\n getDefaultFormatPropsBySystem: (requestedSystem: UnitSystemKey) => FormatProps;\r\n /** Async function to generate a [FormatterSpec]$(core-quantity) that will be called to format values.*/\r\n generateFormatterSpec: (formatProps: FormatProps, unitsProvider: UnitsProvider) => Promise<FormatterSpec>;\r\n /** Async function to generate a [ParserSpec]$(core-quantity) that will be called to parse a string into a quantity value.*/\r\n generateParserSpec: (formatProps: FormatProps, unitsProvider: UnitsProvider, alternateUnitLabelsProvider?: AlternateUnitLabelsProvider) => Promise<ParserSpec>;\r\n}\r\n\r\n/** CustomQuantityTypeDefinition interface is used to define a Custom quantity type that can be registered with the [[QuantityFormatter]].\r\n * A custom quantity formatter must be able to generate a FormatterSpec and ParserSpec that will be called to format and parse values.\r\n * Optionally it can provide specification of custom properties that it will use to define any formatting options. CustomQuantityTypeDefinitions\r\n * must be registered with the [[QuantityFormatter]] using the method `IModelApp.quantityFormatter.registerQuantityType`.\r\n * @public\r\n */\r\nexport interface CustomQuantityTypeDefinition extends QuantityTypeDefinition {\r\n /** Return true if the FormatProps have the necessary `custom` property definition */\r\n isCompatibleFormatProps: (formatProps: FormatProps) => boolean;\r\n /** An array of specifications that are used to generate a label and editor in the UI used to display and edit the FormatProps.\r\n * UI items defined as primary will be shown higher in the list of UI components. */\r\n primaryPropEditorSpecs?: CustomFormatPropEditorSpec[];\r\n /** An array of specifications that are used to generate a label and editor in the UI used to display and edit the FormatProps.\r\n * UI items defined as secondary will be shown below other UI components that edit FormatProps. */\r\n secondaryPropEditorSpecs?: CustomFormatPropEditorSpec[];\r\n}\r\n\r\n/** CustomQuantityTypeDefinition type guard.\r\n * @public\r\n*/\r\nexport function isCustomQuantityTypeDefinition(item: QuantityTypeDefinition): item is CustomQuantityTypeDefinition {\r\n return !!(item as CustomQuantityTypeDefinition).isCompatibleFormatProps;\r\n}\r\n\r\n/** private class to hold standard quantity definitions as defined by QuantityType enum and implement QuantityTypeDefinition interface */\r\nclass StandardQuantityTypeDefinition implements QuantityTypeDefinition {\r\n private _label: string | undefined;\r\n private _description: string | undefined;\r\n private _key: string;\r\n\r\n constructor(public type: QuantityType, public persistenceUnit: UnitProps, private _labelKey: string, private _descriptionKey: string) {\r\n this._key = getQuantityTypeKey(type);\r\n }\r\n\r\n public get key(): string { return this._key; }\r\n\r\n public get label(): string {\r\n if (!this._label) {\r\n this._label = IModelApp.localization.getLocalizedString(this._labelKey);\r\n }\r\n return this._label ?? \"\";\r\n }\r\n\r\n public get description(): string {\r\n if (!this._description) {\r\n this._description = IModelApp.localization.getLocalizedString(this._descriptionKey);\r\n }\r\n return this._description ?? this.label;\r\n }\r\n\r\n /** Get a default format to show quantity in persistence unit with precision or 6 decimal places. */\r\n public getDefaultFormatPropsBySystem(requestedSystem: UnitSystemKey): FormatProps {\r\n // Fallback same as Format \"DefaultRealU\" in Formats ecschema\r\n const fallbackProps: FormatProps = {\r\n formatTraits: [\"keepSingleZero\", \"keepDecimalPoint\", \"showUnitLabel\"],\r\n precision: 6,\r\n type: \"Decimal\",\r\n uomSeparator: \" \",\r\n decimalSeparator: \".\",\r\n };\r\n\r\n const defaultUnitSystemData = DEFAULT_FORMATKEY_BY_UNIT_SYSTEM.find((value) => value.system === requestedSystem);\r\n if (defaultUnitSystemData) {\r\n const defaultFormatEntry = defaultUnitSystemData.entries.find((value) => value.type === this.key);\r\n if (defaultFormatEntry) {\r\n const defaultFormatPropsEntry = DEFAULT_FORMATPROPS.find((props) => props.key === defaultFormatEntry.formatKey);\r\n if (defaultFormatPropsEntry)\r\n return defaultFormatPropsEntry.format;\r\n }\r\n }\r\n\r\n return fallbackProps;\r\n }\r\n\r\n public async generateFormatterSpec(formatProps: FormatProps, unitsProvider: UnitsProvider): Promise<FormatterSpec> {\r\n const format = await Format.createFromJSON(this.key, unitsProvider, formatProps);\r\n return FormatterSpec.create(format.name, format, unitsProvider, this.persistenceUnit);\r\n }\r\n\r\n public async generateParserSpec(formatProps: FormatProps, unitsProvider: UnitsProvider, alternateUnitLabelsProvider?: AlternateUnitLabelsProvider) {\r\n const format = await Format.createFromJSON(this.key, unitsProvider, formatProps);\r\n return ParserSpec.create(format, unitsProvider, this.persistenceUnit, alternateUnitLabelsProvider);\r\n }\r\n}\r\n\r\n/** Override format entries can define formats for any of the different unit systems.\r\n * @public\r\n */\r\nexport interface OverrideFormatEntry {\r\n /** Override format for \"imperial\" unit system */\r\n imperial?: FormatProps;\r\n /** Override format for \"metric\" unit system */\r\n metric?: FormatProps;\r\n /** Override format for \"usCustomary\" unit system */\r\n usCustomary?: FormatProps;\r\n /** Override format for \"usSurvey\" unit system */\r\n usSurvey?: FormatProps;\r\n}\r\n\r\n/**\r\n * Entries returned when looking up specs from the [[QuantityFormatter._formatSpecsRegistry]]\r\n * @beta\r\n */\r\nexport interface FormattingSpecEntry {\r\n formatterSpec: FormatterSpec;\r\n parserSpec: ParserSpec;\r\n}\r\n/** Interface that defines the functions required to be implemented to provide custom formatting and parsing of a custom quantity type.\r\n * @public\r\n */\r\nexport interface FormatterParserSpecsProvider {\r\n /** Custom quantity id */\r\n quantityType: QuantityTypeArg;\r\n /** Async function to return FormatterSpec for a custom quantity type */\r\n createFormatterSpec: (unitSystem: UnitSystemKey) => Promise<FormatterSpec>;\r\n /** Async function to return ParserSpec for a custom quantity type */\r\n createParserSpec: (unitSystem: UnitSystemKey) => Promise<ParserSpec>;\r\n}\r\n\r\n/** Arguments sent to FormattingUnitSystemChanged event listeners.\r\n * @public\r\n */\r\nexport interface FormattingUnitSystemChangedArgs {\r\n /** string that defines unit system activated. */\r\n readonly system: UnitSystemKey;\r\n}\r\n\r\n/** Arguments sent to QuantityFormatsChanged event listeners.\r\n * @public\r\n */\r\nexport interface QuantityFormatsChangedArgs {\r\n /** string that represents the QuantityType that has been overriden or the overrides cleared. */\r\n readonly quantityType: string;\r\n}\r\n\r\n/** Arguments sent to [[UnitFormattingSettingsProvider]] when overrides are changed.\r\n * @public\r\n */\r\nexport interface QuantityFormatOverridesChangedArgs {\r\n /** string that represents the QuantityType that has been overriden or the overrides cleared. */\r\n readonly typeKey: QuantityTypeKey;\r\n /** overrideEntry will be undefined when clearing overrides */\r\n readonly overrideEntry?: OverrideFormatEntry;\r\n /** used only when change applies to a single unit system */\r\n readonly unitSystem?: UnitSystemKey;\r\n}\r\n\r\n/**\r\n * The UnitFormattingSettingsProvider interface is used to store and retrieve override FormatProps and Presentation Unit System\r\n * for use by the QuantityFormatter. If no UnitFormattingSettingsProvider is supplied to the QuantityFormatter then any overrides\r\n * set are lost when the session is closed. The `ui-test-app` has and example implementation that uses browser local storage via the\r\n * class [[LocalUnitFormatProvider]] [here](https://github.com/iTwin/itwinjs-core/blob/d341e030d4c1427effd80ea54b3d57fec8ad1bc1/test-apps/ui-test-app/src/frontend/index.tsx#L315).\r\n * @public\r\n */\r\nexport interface UnitFormattingSettingsProvider {\r\n /** serializes JSON object containing format overrides for a specific quantity type. */\r\n store(quantityTypeKey: QuantityTypeKey, overrideProps: OverrideFormatEntry): Promise<boolean>;\r\n /** retrieves serialized JSON object containing format overrides for a specific quantity type. */\r\n retrieve(quantityTypeKey: QuantityTypeKey): Promise<OverrideFormatEntry | undefined>;\r\n /** removes the override formats for a specific quantity type. */\r\n remove(quantityTypeKey: QuantityTypeKey): Promise<boolean>;\r\n /** retrieves the active unit system typically based on the \"active\" iModelConnection */\r\n retrieveUnitSystem(defaultKey: UnitSystemKey): Promise<UnitSystemKey>;\r\n /** store the active unit system typically for the \"active\" iModelConnection */\r\n storeUnitSystemKey(unitSystemKey: UnitSystemKey): Promise<boolean>;\r\n /** Function to load overrides for a specific IModelConnection. Typically this is not called often since typical\r\n * implementations monitor for IModelConnection changes and call this method internally. */\r\n loadOverrides(imodel: IModelConnection | undefined): Promise<void>;\r\n /** function called to save changes to Presentation Unit System */\r\n storeUnitSystemSetting(args: FormattingUnitSystemChangedArgs): Promise<void>;\r\n /** function called to save format overrides */\r\n storeFormatOverrides(args: QuantityFormatOverridesChangedArgs): Promise<void>;\r\n /** property that is set by the implementation to inform the BaseUnitFormattingSettingsProvider if the provider\r\n * should trigger reloading of the overrides when the \"active\" imodel changes. */\r\n readonly maintainOverridesPerIModel: boolean;\r\n}\r\n\r\n/**\r\n * A default formatsProvider, that provides a limited set of [[FormatDefinition]], associated to a few [[KindOfQuantity]].\r\n * Maps each KindOfQuantity to a [[QuantityType]].\r\n * When retrieving a valid [[KindOfQuantity]], returns the [[FormatProps]] for the associated [[QuantityType]].\r\n * @internal\r\n */\r\nexport class QuantityTypeFormatsProvider implements FormatsProvider {\r\n public onFormatsChanged = new BeEvent<(args: FormatsChangedArgs) => void>();\r\n private _removeListeners: (() => void)[] = [];\r\n public constructor() {\r\n this._removeListeners.push(IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(() => {\r\n this.onFormatsChanged.raiseEvent({ formatsChanged: \"all\" });\r\n }));\r\n }\r\n\r\n public [Symbol.dispose]() {\r\n this._removeListeners.forEach(listener => listener());\r\n }\r\n\r\n private _kindOfQuantityMap = new Map<string, QuantityType>([\r\n [\"AecUnits.LENGTH\", QuantityType.Length],\r\n [\"AecUnits.ANGLE\", QuantityType.Angle],\r\n [\"AecUnits.AREA\", QuantityType.Area],\r\n [\"AecUnits.VOLUME\", QuantityType.Volume],\r\n [\"AecUnits.LENGTH_COORDINATE\", QuantityType.Coordinate],\r\n [\"RoadRailUnits.STATION\", QuantityType.Stationing],\r\n [\"RoadRailUnits.LENGTH\", QuantityType.LengthSurvey],\r\n ]);\r\n\r\n public async getFormat(name: string): Promise<FormatDefinition | undefined> {\r\n const quantityType = this._kindOfQuantityMap.get(name);\r\n if (!quantityType) return undefined;\r\n\r\n return IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n }\r\n}\r\n\r\n/**\r\n * An implementation of the [[FormatsProvider]] interface that forwards calls to getFormats to the underlying FormatsProvider.\r\n * Also fires the onFormatsChanged event when the underlying FormatsProvider fires its own onFormatsChanged event.\r\n * @internal\r\n */\r\nexport class FormatsProviderManager implements FormatsProvider {\r\n public onFormatsChanged = new BeEvent<(args: FormatsChangedArgs) => void>();\r\n\r\n constructor(private _formatsProvider: FormatsProvider) {\r\n this._formatsProvider.onFormatsChanged.addListener((args: FormatsChangedArgs) => {\r\n this.onFormatsChanged.raiseEvent(args);\r\n });\r\n }\r\n\r\n public async getFormat(name: string): Promise<FormatDefinition | undefined> {\r\n return this._formatsProvider.getFormat(name);\r\n }\r\n\r\n public get formatsProvider(): FormatsProvider { return this; }\r\n\r\n public set formatsProvider(formatsProvider: FormatsProvider) {\r\n this._formatsProvider = formatsProvider;\r\n this._formatsProvider.onFormatsChanged.addListener((args: FormatsChangedArgs) => {\r\n this.onFormatsChanged.raiseEvent(args);\r\n });\r\n this.onFormatsChanged.raiseEvent({ formatsChanged: \"all\" });\r\n }\r\n}\r\n/** Class that supports formatting quantity values into strings and parsing strings into quantity values. This class also maintains\r\n * the \"active\" unit system and caches FormatterSpecs and ParserSpecs for the \"active\" unit system to allow synchronous access to\r\n * parsing and formatting values. The support unit systems are defined by [[UnitSystemKey]] and is kept in synch with the unit systems\r\n * provided by the Presentation Manager on the backend. The QuantityFormatter contains a registry of quantity type definitions. These definitions implement\r\n * the [[QuantityTypeDefinition]] interface, which among other things, provide default [[FormatProps]], and provide methods\r\n * to generate both a [[FormatterSpec]] and a [[ParserSpec]]. There are built-in quantity types that are\r\n * identified by the [[QuantityType]] enum. [[CustomQuantityTypeDefinition]] can be registered to extend the available quantity types available\r\n * by frontend tools. The QuantityFormatter also allows the default formats to be overriden.\r\n *\r\n * @public\r\n */\r\nexport class QuantityFormatter implements UnitsProvider {\r\n private _unitsProvider: UnitsProvider = new BasicUnitsProvider();\r\n private _alternateUnitLabelsRegistry = new AlternateUnitLabelsRegistry(getDefaultAlternateUnitLabels());\r\n /** Registry containing available quantity type definitions. */\r\n protected _quantityTypeRegistry: Map<QuantityTypeKey, QuantityTypeDefinition> = new Map<QuantityTypeKey, QuantityTypeDefinition>();\r\n /** Registry containing available FormatterSpec and ParserSpec, mapped by keys.\r\n * @beta\r\n */\r\n protected _formatSpecsRegistry: Map<string, FormattingSpecEntry> = new Map<string, FormattingSpecEntry>();\r\n\r\n /** Active UnitSystem key - must be one of \"imperial\", \"metric\", \"usCustomary\", or \"usSurvey\". */\r\n protected _activeUnitSystem: UnitSystemKey = \"imperial\";\r\n /** Map of FormatSpecs for all available QuantityTypes and the active Unit System */\r\n protected _activeFormatSpecsByType = new Map<QuantityTypeKey, FormatterSpec>();\r\n /** Map of ParserSpecs for all available QuantityTypes and the active Unit System */\r\n protected _activeParserSpecsByType = new Map<QuantityTypeKey, ParserSpec>();\r\n /** Map of FormatSpecs that have been overriden from the default. */\r\n protected _overrideFormatPropsByUnitSystem = new Map<UnitSystemKey, Map<QuantityTypeKey, FormatProps>>();\r\n /** Optional object that gets called to store and retrieve format overrides. */\r\n protected _unitFormattingSettingsProvider: UnitFormattingSettingsProvider | undefined;\r\n\r\n /** Set the settings provider and if not iModel specific initialize setting for user. */\r\n public async setUnitFormattingSettingsProvider(provider: UnitFormattingSettingsProvider) {\r\n this._unitFormattingSettingsProvider = provider;\r\n if (!provider.maintainOverridesPerIModel)\r\n await provider.loadOverrides(undefined);\r\n }\r\n\r\n /** Called after the active unit system is changed.\r\n * The system will report the UnitSystemKey/name of the the system that was activated.\r\n */\r\n public readonly onActiveFormattingUnitSystemChanged = new BeUiEvent<FormattingUnitSystemChangedArgs>();\r\n\r\n /** Called when the format of a QuantityType is overriden or the override is cleared. The string returned will\r\n * be a QuantityTypeKey generated by method `getQuantityTypeKey`.\r\n */\r\n public readonly onQuantityFormatsChanged = new BeUiEvent<QuantityFormatsChangedArgs>();\r\n\r\n /** Fired when the active UnitsProvider is updated. This will allow cached Formatter and Parser specs to be updated if necessary. */\r\n public readonly onUnitsProviderChanged = new BeUiEvent<void>();\r\n\r\n private _removeFormatsProviderListener?: () => void;\r\n /**\r\n * constructor\r\n * @param showMetricOrUnitSystem - Pass in `true` to show Metric formatted quantity values. Defaults to Imperial. To explicitly\r\n * set it to a specific unit system pass a UnitSystemKey.\r\n */\r\n constructor(showMetricOrUnitSystem?: boolean | UnitSystemKey) {\r\n if (undefined !== showMetricOrUnitSystem) {\r\n if (typeof showMetricOrUnitSystem === \"boolean\")\r\n this._activeUnitSystem = showMetricOrUnitSystem ? \"metric\" : \"imperial\";\r\n else\r\n this._activeUnitSystem = showMetricOrUnitSystem;\r\n }\r\n }\r\n\r\n public [Symbol.dispose](): void {\r\n if (this._removeFormatsProviderListener) {\r\n this._removeFormatsProviderListener();\r\n this._removeFormatsProviderListener = undefined;\r\n }\r\n }\r\n\r\n private getOverrideFormatPropsByQuantityType(quantityTypeKey: QuantityTypeKey, unitSystem?: UnitSystemKey): FormatProps | undefined {\r\n const requestedUnitSystem = unitSystem ?? this.activeUnitSystem;\r\n const overrideMap = this._overrideFormatPropsByUnitSystem.get(requestedUnitSystem);\r\n if (!overrideMap)\r\n return undefined;\r\n\r\n return overrideMap.get(quantityTypeKey);\r\n }\r\n\r\n /** Method used to register all QuantityTypes defined in QuantityType enum. */\r\n protected async initializeQuantityTypesRegistry() {\r\n // QuantityType.Length\r\n const lengthUnit = await this.findUnitByName(\"Units.M\");\r\n const lengthDefinition = new StandardQuantityTypeDefinition(QuantityType.Length, lengthUnit,\r\n \"iModelJs:QuantityType.Length.label\", \"iModelJs:QuantityType.Length.description\");\r\n this._quantityTypeRegistry.set(lengthDefinition.key, lengthDefinition);\r\n\r\n // QuantityType.LengthEngineering\r\n const lengthEngineeringDefinition = new StandardQuantityTypeDefinition(QuantityType.LengthEngineering, lengthUnit,\r\n \"iModelJs:QuantityType.LengthEngineering.label\", \"iModelJs:QuantityType.LengthEngineering.description\");\r\n this._quantityTypeRegistry.set(lengthEngineeringDefinition.key, lengthEngineeringDefinition);\r\n\r\n // QuantityType.Coordinate\r\n const coordinateDefinition = new StandardQuantityTypeDefinition(QuantityType.Coordinate, lengthUnit,\r\n \"iModelJs:QuantityType.Coordinate.label\", \"iModelJs:QuantityType.Coordinate.description\");\r\n this._quantityTypeRegistry.set(coordinateDefinition.key, coordinateDefinition);\r\n\r\n // QuantityType.Stationing\r\n const stationingDefinition = new StandardQuantityTypeDefinition(QuantityType.Stationing, lengthUnit,\r\n \"iModelJs:QuantityType.Stationing.label\", \"iModelJs:QuantityType.Stationing.description\");\r\n this._quantityTypeRegistry.set(stationingDefinition.key, stationingDefinition);\r\n\r\n // QuantityType.LengthSurvey\r\n const lengthSurveyDefinition = new StandardQuantityTypeDefinition(QuantityType.LengthSurvey, lengthUnit,\r\n \"iModelJs:QuantityType.LengthSurvey.label\", \"iModelJs:QuantityType.LengthSurvey.description\");\r\n this._quantityTypeRegistry.set(lengthSurveyDefinition.key, lengthSurveyDefinition);\r\n\r\n // QuantityType.Angle\r\n const radUnit = await this.findUnitByName(\"Units.RAD\");\r\n const angleDefinition = new StandardQuantityTypeDefinition(QuantityType.Angle, radUnit,\r\n \"iModelJs:QuantityType.Angle.label\", \"iModelJs:QuantityType.Angle.description\");\r\n this._quantityTypeRegistry.set(angleDefinition.key, angleDefinition);\r\n\r\n // QuantityType.LatLong\r\n const latLongDefinition = new StandardQuantityTypeDefinition(QuantityType.LatLong, radUnit,\r\n \"iModelJs:QuantityType.LatLong.label\", \"iModelJs:QuantityType.LatLong.description\");\r\n this._quantityTypeRegistry.set(latLongDefinition.key, latLongDefinition);\r\n\r\n // QuantityType.Area\r\n const sqMetersUnit = await this.findUnitByName(\"Units.SQ_M\");\r\n const areaDefinition = new StandardQuantityTypeDefinition(QuantityType.Area, sqMetersUnit,\r\n \"iModelJs:QuantityType.Area.label\", \"iModelJs:QuantityType.Area.description\");\r\n this._quantityTypeRegistry.set(areaDefinition.key, areaDefinition);\r\n\r\n // QuantityType.Volume\r\n const cubicMetersUnit = await this.findUnitByName(\"Units.CUB_M\");\r\n const volumeDefinition = new StandardQuantityTypeDefinition(QuantityType.Volume, cubicMetersUnit,\r\n \"iModelJs:QuantityType.Volume.label\", \"iModelJs:QuantityType.Volume.description\");\r\n this._quantityTypeRegistry.set(volumeDefinition.key, volumeDefinition);\r\n }\r\n\r\n /** Asynchronous call to load Formatting and ParsingSpecs for a unit system. This method ends up caching FormatterSpecs and ParserSpecs\r\n * so they can be quickly accessed.\r\n * @internal public for unit test usage\r\n */\r\n protected async loadFormatAndParsingMapsForSystem(systemType?: UnitSystemKey): Promise<void> {\r\n const systemKey = (undefined !== systemType) ? systemType : this._activeUnitSystem;\r\n const formatPropsByType = new Map<QuantityTypeDefinition, FormatProps>();\r\n\r\n // load cache for every registered QuantityType\r\n for (const [_, entry] of this.quantityTypesRegistry) {\r\n formatPropsByType.set(entry, this.getFormatPropsByQuantityTypeEntryAndSystem(entry, systemKey));\r\n };\r\n\r\n for (const [entry, formatProps] of formatPropsByType) {\r\n await this.loadFormatAndParserSpec(entry, formatProps);\r\n }\r\n }\r\n\r\n private getFormatPropsByQuantityTypeEntryAndSystem(quantityEntry: QuantityTypeDefinition, requestedSystem: UnitSystemKey, ignoreOverrides?: boolean): FormatProps {\r\n if (!ignoreOverrides) {\r\n const overrideProps = this.getOverrideFormatPropsByQuantityType(quantityEntry.key, requestedSystem);\r\n if (overrideProps)\r\n return overrideProps;\r\n }\r\n\r\n return quantityEntry.getDefaultFormatPropsBySystem(requestedSystem);\r\n }\r\n\r\n private async loadFormatAndParserSpec(quantityTypeDefinition: QuantityTypeDefinition, formatProps: FormatProps) {\r\n const formatterSpec = await quantityTypeDefinition.generateFormatterSpec(formatProps, this.unitsProvider);\r\n const parserSpec = await quantityTypeDefinition.generateParserSpec(formatProps, this.unitsProvider, this.alternateUnitLabelsProvider);\r\n this._activeFormatSpecsByType.set(quantityTypeDefinition.key, formatterSpec);\r\n this._activeParserSpecsByType.set(quantityTypeDefinition.key, parserSpec);\r\n }\r\n\r\n // repopulate formatSpec and parserSpec entries using only default format\r\n private async loadDefaultFormatAndParserSpecForQuantity(typeKey: QuantityTypeKey) {\r\n const quantityTypeDefinition = this.quantityTypesRegistry.get(typeKey);\r\n if (!quantityTypeDefinition)\r\n throw new Error(`Unable to locate QuantityType by key ${typeKey}`);\r\n\r\n const defaultFormat = quantityTypeDefinition.getDefaultFormatPropsBySystem(this.activeUnitSystem);\r\n await this.loadFormatAndParserSpec(quantityTypeDefinition, defaultFormat);\r\n }\r\n\r\n private async setOverrideFormatsByQuantityTypeKey(typeKey: QuantityTypeKey, overrideEntry: OverrideFormatEntry) {\r\n // extract overrides and insert into appropriate override map entry\r\n Object.keys(overrideEntry).forEach((systemKey) => {\r\n const unitSystemKey = systemKey as UnitSystemKey;\r\n const props = overrideEntry[unitSystemKey];\r\n if (props) {\r\n if (this._overrideFormatPropsByUnitSystem.has(unitSystemKey)) {\r\n // We just verified that unitSystemKey is present.\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n this._overrideFormatPropsByUnitSystem.get(unitSystemKey)!.set(typeKey, props);\r\n } else {\r\n const newMap = new Map<string, FormatProps>();\r\n newMap.set(typeKey, props);\r\n this._overrideFormatPropsByUnitSystem.set(unitSystemKey, newMap);\r\n }\r\n }\r\n });\r\n\r\n await this._unitFormattingSettingsProvider?.storeFormatOverrides({ typeKey, overrideEntry });\r\n\r\n const formatProps = this.getOverrideFormatPropsByQuantityType(typeKey, this.activeUnitSystem);\r\n if (formatProps) {\r\n const typeEntry = this.quantityTypesRegistry.get(typeKey);\r\n if (typeEntry) {\r\n await this.loadFormatAndParserSpec(typeEntry, formatProps);\r\n // trigger a message to let callers know the format has changed.\r\n this.onQuantityFormatsChanged.emit({ quantityType: typeKey });\r\n }\r\n }\r\n }\r\n\r\n /** Method called to clear override and restore defaults formatter and parser spec */\r\n private async clearOverrideFormatsByQuantityTypeKey(type: QuantityTypeKey) {\r\n const unitSystem = this.activeUnitSystem;\r\n if (this.getOverrideFormatPropsByQuantityType(type, unitSystem)) {\r\n const overrideMap = this._overrideFormatPropsByUnitSystem.get(unitSystem);\r\n if (overrideMap && overrideMap.has(type)) {\r\n overrideMap.delete(type);\r\n await this._unitFormattingSettingsProvider?.storeFormatOverrides({ typeKey: type, unitSystem });\r\n\r\n await this.loadDefaultFormatAndParserSpecForQuantity(type);\r\n // trigger a message to let callers know the format has changed.\r\n this.onQuantityFormatsChanged.emit({ quantityType: type });\r\n }\r\n }\r\n }\r\n\r\n /** This method is called during IModelApp initialization to load the standard quantity types into the registry and to initialize the cache.\r\n * @internal\r\n */\r\n public async onInitialized() {\r\n await this.initializeQuantityTypesRegistry();\r\n\r\n const initialKoQs = [[\"AecUnits.LENGTH\", \"Units.M\"], [\"AecUnits.ANGLE\", \"Units.RAD\"], [\"AecUnits.AREA\", \"Units.SQ_M\"], [\"AecUnits.VOLUME\", \"Units.CUB_M\"], [\"AecUnits.LENGTH_COORDINATE\", \"Units.M\"], [\"RoadRailUnits.STATION\", \"Units.M\"], [\"RoadRailUnits.LENGTH\", \"Units.M\"]];\r\n for (const entry of initialKoQs) {\r\n try {\r\n await this.addFormattingSpecsToRegistry(entry[0], entry[1]);\r\n } catch (err: any) {\r\n Logger.logWarning(`${FrontendLoggerCategory.Package}.QuantityFormatter`, err.toString());\r\n }\r\n }\r\n this._removeFormatsProviderListener = IModelApp.formatsProvider.onFormatsChanged.addListener(async (args: FormatsChangedArgs) => {\r\n if (args.formatsChanged === \"all\") {\r\n for (const [name, entry] of this._formatSpecsRegistry.entries()) {\r\n const formatProps = await IModelApp.formatsProvider.getFormat(name);\r\n if (formatProps) {\r\n const persistenceUnitName = entry.formatterSpec.persistenceUnit.name;\r\n await this.addFormattingSpecsToRegistry(name, persistenceUnitName, formatProps);\r\n } else {\r\n this._formatSpecsRegistry.delete(name); // clear the specs if format was removed, or no longer exists.\r\n }\r\n }\r\n } else {\r\n for (const name of args.formatsChanged) {\r\n if (this._formatSpecsRegistry.has(name)) {\r\n const formatProps = await IModelApp.formatsProvider.getFormat(name);\r\n if (formatProps) {\r\n const existingEntry = this._formatSpecsRegistry.get(name);\r\n if (existingEntry) {\r\n const persistenceUnitName = existingEntry.formatterSpec.persistenceUnit.name;\r\n await this.addFormattingSpecsToRegistry(name, persistenceUnitName, formatProps);\r\n }\r\n } else {\r\n this._formatSpecsRegistry.delete(name);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n\r\n // initialize default format and parsing specs\r\n await this.loadFormatAndParsingMapsForSystem();\r\n }\r\n\r\n /** Return a map that serves as a registry of all standard and custom quantity types. */\r\n public get quantityTypesRegistry() {\r\n return this._quantityTypeRegistry;\r\n }\r\n\r\n /** Return the class the contain map of all alternate labels for units. These alternate labels are used when parsing strings in quantity values. */\r\n public get alternateUnitLabelsProvider(): AlternateUnitLabelsProvider {\r\n return this._alternateUnitLabelsRegistry;\r\n }\r\n\r\n /**\r\n * Add one or more alternate labels for a unit - these labels are used during string parsing.\r\n * @param key UnitNameKey which comes from `UnitProps.name`\r\n * @param labels one or more unit labels\r\n */\r\n public addAlternateLabels(key: UnitNameKey, ...labels: string[]) {\r\n this._alternateUnitLabelsRegistry.addAlternateLabels(key, ...labels);\r\n this.onUnitsProviderChanged.emit();\r\n }\r\n\r\n /** Get/Set the active UnitsProvider class. */\r\n public get unitsProvider() {\r\n return this._unitsProvider;\r\n }\r\n\r\n public set unitsProvider(unitsProvider: UnitsProvider) {\r\n this.setUnitsProvider(unitsProvider); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n /** async method to set a units provider and reload caches */\r\n public async setUnitsProvider(unitsProvider: UnitsProvider) {\r\n this._unitsProvider = unitsProvider;\r\n\r\n try {\r\n // force all cached data to be reinitialized\r\n await IModelApp.quantityFormatter.onInitialized();\r\n } catch(err) {\r\n Logger.logWarning(`${FrontendLoggerCategory.Package}.quantityFormatter`, BentleyError.getErrorMessage(err), BentleyError.getErrorMetadata(err));\r\n Logger.logWarning(`${FrontendLoggerCategory.Package}.quantityFormatter`, \"An exception occurred initializing the iModelApp.quantityFormatter with the given UnitsProvider. Defaulting back to the internal units provider.\");\r\n // If there is a problem initializing with the given provider, default back to the internal provider\r\n await IModelApp.quantityFormatter.resetToUseInternalUnitsProvider();\r\n return;\r\n }\r\n\r\n // force default tool to start so any tool that may be using cached data will not be using bad data.\r\n if (IModelApp.toolAdmin)\r\n await IModelApp.toolAdmin.startDefaultTool();\r\n this.onUnitsProviderChanged.emit();\r\n }\r\n\r\n /** Async call typically used after IModel is closed to reset UnitsProvider to default one that does not require an Units schema. */\r\n public async resetToUseInternalUnitsProvider() {\r\n if (this._unitsProvider instanceof BasicUnitsProvider)\r\n return;\r\n\r\n await this.setUnitsProvider(new BasicUnitsProvider());\r\n }\r\n\r\n /** Async call to register a CustomQuantityType and load the FormatSpec and ParserSpec for the new type. */\r\n public async registerQuantityType(entry: CustomQuantityTypeDefinition, replace?: boolean) {\r\n if (!replace && this._quantityTypeRegistry.has(entry.key))\r\n return false;\r\n\r\n this._quantityTypeRegistry.set(entry.key, entry);\r\n // load any overrides so any saved overrides for the type being registered are applied\r\n if (this._unitFormattingSettingsProvider)\r\n await this._unitFormattingSettingsProvider.loadOverrides(undefined);\r\n\r\n if (entry.getDefaultFormatPropsBySystem) {\r\n const formatProps = entry.getDefaultFormatPropsBySystem(this.activeUnitSystem);\r\n await this.loadFormatAndParserSpec(entry, formatProps);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** Reinitialize caches. Typically called by active UnitFormattingSettingsProvider.\r\n * startDefaultTool - set to true to start the Default to instead of leaving any active tool pointing to cached unit data that is no longer valid\r\n * @public\r\n */\r\n public async reinitializeFormatAndParsingsMaps(overrideFormatPropsByUnitSystem: Map<UnitSystemKey, Map<QuantityTypeKey, FormatProps>>,\r\n unitSystemKey?: UnitSystemKey, fireUnitSystemChanged?: boolean, startDefaultTool?: boolean): Promise<void> {\r\n this._overrideFormatPropsByUnitSystem.clear();\r\n if (overrideFormatPropsByUnitSystem.size) {\r\n this._overrideFormatPropsByUnitSystem = overrideFormatPropsByUnitSystem;\r\n }\r\n\r\n unitSystemKey && (this._activeUnitSystem = unitSystemKey);\r\n await this.loadFormatAndParsingMapsForSystem(this._activeUnitSystem);\r\n fireUnitSystemChanged && this.onActiveFormattingUnitSystemChanged.emit({ system: this._activeUnitSystem });\r\n IModelApp.toolAdmin && startDefaultTool && await IModelApp.toolAdmin.startDefaultTool();\r\n }\r\n\r\n /** Set the Active unit system to one of the supported types. This will asynchronously load the formatter and parser specs for the activated system. */\r\n public async setActiveUnitSystem(isImperialOrUnitSystem: UnitSystemKey | boolean, restartActiveTool?: boolean): Promise<void> {\r\n let systemType: UnitSystemKey;\r\n if (typeof isImperialOrUnitSystem === \"boolean\")\r\n systemType = isImperialOrUnitSystem ? \"imperial\" : \"metric\";\r\n else\r\n systemType = isImperialOrUnitSystem;\r\n\r\n if (this._activeUnitSystem === systemType)\r\n return;\r\n\r\n this._activeUnitSystem = systemType;\r\n await this.loadFormatAndParsingMapsForSystem(systemType);\r\n // allow settings provider to store the change\r\n await this._unitFormattingSettingsProvider?.storeUnitSystemSetting({ system: systemType });\r\n // fire current event\r\n this.onActiveFormattingUnitSystemChanged.emit({ system: systemType });\r\n if (IModelApp.toolAdmin && restartActiveTool)\r\n return IModelApp.toolAdmin.startDefaultTool();\r\n }\r\n\r\n /** Retrieve the active [[UnitSystemKey]] which is used to determine what formats are to be used to display quantities */\r\n public get activeUnitSystem(): UnitSystemKey { return this._activeUnitSystem; }\r\n\r\n /** Clear any formatting override for specified quantity type, but only for the \"active\" Unit System. */\r\n public async clearOverrideFormats(type: QuantityTypeArg) {\r\n await this.clearOverrideFormatsByQuantityTypeKey(this.getQuantityTypeKey(type));\r\n }\r\n\r\n /** Set formatting override for specified quantity type, but only for the \"active\" Unit System. */\r\n public async setOverrideFormats(type: QuantityTypeArg, overrideEntry: OverrideFormatEntry) {\r\n await this.setOverrideFormatsByQuantityTypeKey(this.getQuantityTypeKey(type), overrideEntry);\r\n }\r\n\r\n /** Set Override Format for a quantity type, but only in the \"active\" Unit System. */\r\n public async setOverrideFormat(type: QuantityTypeArg, overrideFormat: FormatProps) {\r\n const typeKey = this.getQuantityTypeKey(type);\r\n let overrideEntry: OverrideFormatEntry = {};\r\n if (this.activeUnitSystem === \"imperial\")\r\n overrideEntry = { imperial: overrideFormat };\r\n else if (this.activeUnitSystem === \"metric\")\r\n overrideEntry = { metric: overrideFormat };\r\n else if (this.activeUnitSystem === \"usCustomary\")\r\n overrideEntry = { usCustomary: overrideFormat };\r\n else\r\n overrideEntry = { usSurvey: overrideFormat };\r\n\r\n await this.setOverrideFormatsByQuantityTypeKey(typeKey, overrideEntry);\r\n }\r\n\r\n /** Clear formatting override for all quantity types, but only for the \"active\" Unit System. */\r\n public async clearAllOverrideFormats() {\r\n if (0 === this._overrideFormatPropsByUnitSystem.size)\r\n return;\r\n\r\n if (this._overrideFormatPropsByUnitSystem.has(this.activeUnitSystem)) {\r\n const overrides = this._overrideFormatPropsByUnitSystem.get(this.activeUnitSystem);\r\n const typesRemoved: string[] = [];\r\n if (overrides && overrides.size) {\r\n const promises = new Array<Promise<void> | undefined>();\r\n overrides.forEach((_props, typeKey) => {\r\n typesRemoved.push(typeKey);\r\n promises.push(this._unitFormattingSettingsProvider?.storeFormatOverrides({ typeKey, unitSystem: this.activeUnitSystem }));\r\n });\r\n await Promise.all(promises);\r\n }\r\n\r\n if (typesRemoved.length) {\r\n const promises = new Array<Promise<void>>();\r\n typesRemoved.forEach((typeRemoved) => promises.push(this.loadDefaultFormatAndParserSpecForQuantity(typeRemoved)));\r\n await Promise.all(promises);\r\n // trigger a message to let callers know the format has changed.\r\n this.onQuantityFormatsChanged.emit({ quantityType: typesRemoved.join(\"|\") });\r\n }\r\n }\r\n }\r\n\r\n /** Converts a QuantityTypeArg into a QuantityTypeKey/string value that can be used to lookup custom and standard quantity types. */\r\n public getQuantityTypeKey(type: QuantityTypeArg): string {\r\n return getQuantityTypeKey(type);\r\n }\r\n\r\n /** Return [[QuantityTypeDefinition]] if type has been registered. Standard QuantityTypes are automatically registered. */\r\n public getQuantityDefinition(type: QuantityTypeArg) {\r\n return this.quantityTypesRegistry.get(this.getQuantityTypeKey(type));\r\n }\r\n\r\n /** Synchronous call to get a FormatterSpec of a QuantityType. If the FormatterSpec is not yet cached an undefined object is returned. The\r\n * cache is populated by the async call loadFormatAndParsingMapsForSystem.\r\n */\r\n public findFormatterSpecByQuantityType(type: QuantityTypeArg, _unused?: boolean): FormatterSpec | undefined {\r\n return this._activeFormatSpecsByType.get(this.getQuantityTypeKey(type));\r\n }\r\n\r\n /** Asynchronous Call to get a FormatterSpec for a QuantityType. This formatter spec can be used to synchronously format quantities. */\r\n public async generateFormatterSpecByType(type: QuantityTypeArg, formatProps: FormatProps) {\r\n const quantityTypeDefinition = this.quantityTypesRegistry.get(this.getQuantityTypeKey(type));\r\n if (quantityTypeDefinition)\r\n return quantityTypeDefinition.generateFormatterSpec(formatProps, this.unitsProvider);\r\n\r\n throw new Error(`Unable to generate FormatSpec for QuantityType ${type}`);\r\n }\r\n\r\n /** Asynchronous Call to get a FormatterSpec for a QuantityType and a Unit System. This formatter spec can be used to synchronously format quantities.\r\n * @param type One of the built-in quantity types supported.\r\n * @param system Requested unit system key. Note it is more efficient to use setActiveUnitSystem to set up formatters for all\r\n * quantity types of a unit system.\r\n * @return A FormatterSpec Promise.\r\n */\r\n public async getFormatterSpecByQuantityTypeAndSystem(type: QuantityTypeArg, system?: UnitSystemKey): Promise<FormatterSpec | undefined> {\r\n const quantityKey = this.getQuantityTypeKey(type);\r\n const requestedSystem = system ?? this.activeUnitSystem;\r\n\r\n if (requestedSystem === this.activeUnitSystem) {\r\n const formatterSpec = this._activeFormatSpecsByType.get(quantityKey);\r\n if (formatterSpec)\r\n return formatterSpec;\r\n }\r\n\r\n const entry = this.quantityTypesRegistry.get(quantityKey);\r\n if (!entry)\r\n throw new Error(`Unable to find registered quantity type with key ${quantityKey}`);\r\n return entry.generateFormatterSpec(this.getFormatPropsByQuantityTypeEntryAndSystem(entry, requestedSystem), this.unitsProvider);\r\n }\r\n\r\n /** Asynchronous Call to get a FormatterSpec for a QuantityType.\r\n * @param type One of the built-in quantity types supported.\r\n * @param isImperial Argument to specify use of imperial or metric unit system. If left undefined the active unit system is used.\r\n * @return A FormatterSpec Promise.\r\n */\r\n public async getFormatterSpecByQuantityType(type: QuantityTypeArg, isImperial?: boolean): Promise<FormatterSpec | undefined> {\r\n let requestedSystem = this.activeUnitSystem;\r\n if (undefined !== isImperial)\r\n requestedSystem = isImperial ? \"imperial\" : \"metric\";\r\n return this.getFormatterSpecByQuantityTypeAndSystem(type, requestedSystem);\r\n }\r\n\r\n /** Synchronous call to get a ParserSpec for a QuantityType. If the ParserSpec is not yet cached an undefined object is returned. The\r\n * cache is populated when the active units system is set.\r\n */\r\n public findParserSpecByQuantityType(type: QuantityTypeArg): ParserSpec | undefined {\r\n return this._activeParserSpecsByType.get(this.getQuantityTypeKey(type));\r\n }\r\n\r\n /** Asynchronous Call to get a ParserSpec for a QuantityType. If the UnitSystemKey is not specified the active Unit System is used. **/\r\n public async getParserSpecByQuantityTypeAndSystem(type: QuantityTypeArg, system?: UnitSystemKey): Promise<ParserSpec | undefined> {\r\n const quantityKey = this.getQuantityTypeKey(type);\r\n const requestedSystem = system ?? this.activeUnitSystem;\r\n\r\n if (requestedSystem === this.activeUnitSystem) {\r\n const parserSpec = this._activeParserSpecsByType.get(quantityKey);\r\n if (parserSpec)\r\n return parserSpec;\r\n }\r\n\r\n const entry = this.quantityTypesRegistry.get(quantityKey);\r\n if (!entry)\r\n throw new Error(`Unable to find registered quantity type with key ${quantityKey}`);\r\n return entry.generateParserSpec(this.getFormatPropsByQuantityTypeEntryAndSystem(entry, requestedSystem), this.unitsProvider);\r\n }\r\n\r\n /** Asynchronous Call to get a ParserSpec for a QuantityType.\r\n * @param type One of the built-in quantity types supported.\r\n * @param isImperial Argument to specify use of imperial or metric unit system. If left undefined the active unit system is used.\r\n * @return A FormatterSpec Promise.\r\n */\r\n public async getParserSpecByQuantityType(type: QuantityTypeArg, isImperial?: boolean): Promise<ParserSpec | undefined> {\r\n let requestedSystem = this.activeUnitSystem;\r\n if (undefined !== isImperial)\r\n requestedSystem = isImperial ? \"imperial\" : \"metric\";\r\n return this.getParserSpecByQuantityTypeAndSystem(type, requestedSystem);\r\n }\r\n\r\n /** Generates a formatted string asynchronously for a quantity given the provided properties.\r\n * @param props - an object containing value, valueUnitName, and kindOfQuantityName.\r\n * @return A promise resolving to a formatted string.\r\n */\r\n public formatQuantity(props: {\r\n value: number;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n }): Promise<string>;\r\n /** Generates a formatted string for a quantity given its format spec.\r\n * @param magnitude The magnitude of the quantity.\r\n * @param formatSpec The format specification. See methods getFormatterSpecByQuantityType and findFormatterSpecByQuantityType.\r\n * @return a formatted string.\r\n */\r\n public formatQuantity(magnitude: number, formatSpec?: FormatterSpec): string;\r\n\r\n public formatQuantity(args: number | object, spec?: FormatterSpec): string | Promise<string> {\r\n if (typeof args === \"number\") {\r\n /** Format a quantity value. Default FormatterSpec implementation uses Formatter.formatQuantity. */\r\n const magnitude = args;\r\n if (spec)\r\n return spec.applyFormatting(magnitude);\r\n return magnitude.toString();\r\n }\r\n\r\n return this.formatQuantityAsync(args as {\r\n value: number;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n });\r\n }\r\n\r\n private async formatQuantityAsync(args: {\r\n value: number;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n }): Promise<string> {\r\n const { value, valueUnitName, kindOfQuantityName } = args;\r\n const formatProps = await IModelApp.formatsProvider.getFormat(kindOfQuantityName);\r\n if (!formatProps) return value.toString();\r\n const formatSpec = await this.createFormatterSpec({\r\n persistenceUnitName: valueUnitName,\r\n formatProps,\r\n formatName: kindOfQuantityName,\r\n })\r\n return formatSpec.applyFormatting(value);\r\n }\r\n\r\n /** Parse input string asynchronously into a quantity given the provided properties.\r\n * @param props - an object containing value, valueUnitName, and kindOfQuantityName.\r\n * @return Promise resolving to a QuantityParseResult object containing either the parsed value or an error value if unsuccessful.\r\n */\r\n public parseToQuantityValue(props: {\r\n value: string;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n }): Promise<QuantityParseResult>;\r\n /** Parse input string into quantity given the ParserSpec\r\n * @param inString The magnitude of the quantity.\r\n * @param parserSpec The parse specification the defines the expected format of the string and the conversion to the output unit.\r\n * @return QuantityParseResult object containing either the parsed value or an error value if unsuccessful.\r\n */\r\n public parseToQuantityValue(inString: string, parserSpec?: ParserSpec): QuantityParseResult;\r\n\r\n public parseToQuantityValue(args: string | object, parserSpec?: ParserSpec): QuantityParseResult | Promise<QuantityParseResult> {\r\n if (typeof args === \"string\") {\r\n /** Parse a quantity value. Default ParserSpec implementation uses ParserSpec.parseToQuantityValue. */\r\n const inString = args;\r\n if (parserSpec)\r\n return parserSpec.parseToQuantityValue(inString);\r\n return { ok: false, error: ParseError.InvalidParserSpec };\r\n }\r\n return this.parseToQuantityValueAsync(args as {\r\n value: string;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n });\r\n }\r\n\r\n private async parseToQuantityValueAsync(args: {\r\n value: string;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n }): Promise<QuantityParseResult> {\r\n const { value, valueUnitName, kindOfQuantityName } = args;\r\n const formatProps = await IModelApp.formatsProvider.getFormat(kindOfQuantityName);\r\n if (!formatProps) return { ok: false, error: ParseError.InvalidParserSpec };\r\n const parserSpec = await this.createParserSpec({\r\n persistenceUnitName: valueUnitName,\r\n formatProps,\r\n formatName: kindOfQuantityName,\r\n });\r\n return parserSpec.parseToQuantityValue(value);\r\n }\r\n\r\n /**\r\n * Get a UnitSystemKey from a string that may have been entered via a key-in. Supports different variation of\r\n * unit system names that have been used in the past.\r\n */\r\n public getUnitSystemFromString(inputSystem: string, fallback?: UnitSystemKey): UnitSystemKey {\r\n switch (inputSystem.toLowerCase()) {\r\n case \"metric\":\r\n case \"si\":\r\n return \"metric\";\r\n case \"imperial\":\r\n case \"british-imperial\":\r\n return \"imperial\";\r\n case \"uscustomary\":\r\n case \"us-customary\":\r\n case \"us\":\r\n return \"usCustomary\";\r\n case \"ussurvey\":\r\n case \"us-survey\":\r\n case \"survey\":\r\n return \"usSurvey\";\r\n default:\r\n if (undefined !== fallback)\r\n return fallback;\r\n break;\r\n }\r\n return \"imperial\";\r\n }\r\n\r\n /** Return true if the QuantityType is using an override format. */\r\n public hasActiveOverride(type: QuantityTypeArg, checkOnlyActiveUnitSystem?: boolean): boolean {\r\n const quantityTypeKey = this.getQuantityTypeKey(type);\r\n\r\n if (checkOnlyActiveUnitSystem) {\r\n const overrides = this._overrideFormatPropsByUnitSystem.get(this.activeUnitSystem);\r\n if (overrides && overrides.has(quantityTypeKey))\r\n return true;\r\n return false;\r\n }\r\n\r\n for (const [_key, overrideMap] of this._overrideFormatPropsByUnitSystem) {\r\n if (overrideMap.has(quantityTypeKey))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** Get the cached FormatProps give a quantity type. If ignoreOverrides is false then if the format has been overridden\r\n * the overridden format is returned, else the standard format is returned.\r\n */\r\n public getFormatPropsByQuantityType(quantityType: QuantityTypeArg, requestedSystem?: UnitSystemKey, ignoreOverrides?: boolean) {\r\n const quantityEntry = this.quantityTypesRegistry.get(this.getQuantityTypeKey(quantityType));\r\n if (quantityEntry)\r\n return this.getFormatPropsByQuantityTypeEntryAndSystem(quantityEntry, requestedSystem ?? this.activeUnitSystem, ignoreOverrides);\r\n return undefined;\r\n }\r\n\r\n // keep following to maintain existing API of implementing UnitsProvider\r\n /** Find [UnitProp] for a specific unit label. */\r\n public async findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\r\n return this._unitsProvider.findUnit(unitLabel, schemaName, phenomenon, unitSystem);\r\n }\r\n\r\n /** Returns all defined units for the specified Unit Family/Phenomenon. */\r\n public async getUnitsByFamily(phenomenon: string): Promise<UnitProps[]> {\r\n return this._unitsProvider.getUnitsByFamily(phenomenon);\r\n }\r\n\r\n /** Find [UnitProp] for a specific unit name. */\r\n public async findUnitByName(unitName: string): Promise<UnitProps> {\r\n return this._unitsProvider.findUnitByName(unitName);\r\n }\r\n\r\n /** Returns data needed to convert from one Unit to another in the same Unit Family/Phenomenon. */\r\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps> {\r\n return this._unitsProvider.getConversion(fromUnit, toUnit);\r\n }\r\n\r\n /**\r\n * Creates a [[FormatterSpec]] for a given persistence unit name and format properties, using the [[UnitsProvider]] to resolve the persistence unit.\r\n * @beta\r\n * @param props - A [[CreateFormattingSpecProps]] interface.\r\n */\r\n public async createFormatterSpec(props: CreateFormattingSpecProps): Promise<FormatterSpec> {\r\n const { persistenceUnitName, formatProps, formatName } = props;\r\n const persistenceUnitProps = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(formatName ?? \"temp\", this._unitsProvider, formatProps);\r\n return FormatterSpec.create(`${format.name}_format_spec`, format, this._unitsProvider, persistenceUnitProps);\r\n }\r\n\r\n /**\r\n * Creates a [[ParserSpec]] for a given persistence unit name and format properties, using the [[UnitsProvider]] to resolve the persistence unit.\r\n * @beta\r\n * @param props - A [[CreateFormattingSpecProps]] object.\r\n */\r\n public async createParserSpec(props: CreateFormattingSpecProps): Promise<ParserSpec> {\r\n const { persistenceUnitName, formatProps, formatName } = props;\r\n const persistenceUnitProps = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(formatName ?? \"temp\", this._unitsProvider, formatProps);\r\n return ParserSpec.create(format, this._unitsProvider, persistenceUnitProps);\r\n }\r\n\r\n /**\r\n * @beta\r\n * Returns a [[FormattingSpecEntry]] for a given name, typically a KindOfQuantity full name.\r\n */\r\n public getSpecsByName(name: string): FormattingSpecEntry | undefined {\r\n return this._formatSpecsRegistry.get(name);\r\n }\r\n\r\n /**\r\n * Populates the registry with a new FormatterSpec and ParserSpec entry for the given format name.\r\n * @beta\r\n * @param name The key used to identify the formatter and parser spec\r\n * @param persistenceUnitName The name of the persistence unit\r\n * @param formatProps If not supplied, tries to retrieve the [[FormatProps]] from [[IModelApp.formatsProvider]]\r\n */\r\n public async addFormattingSpecsToRegistry(name: string, persistenceUnitName: string, formatProps?: FormatProps): Promise<void> {\r\n if (!formatProps) {\r\n formatProps = await IModelApp.formatsProvider.getFormat(name);\r\n }\r\n if (formatProps) {\r\n const formatterSpec = await this.createFormatterSpec({\r\n persistenceUnitName,\r\n formatProps,\r\n formatName: name,\r\n });\r\n const parserSpec = await this.createParserSpec({\r\n persistenceUnitName,\r\n formatProps,\r\n formatName: name,\r\n });\r\n this._formatSpecsRegistry.set(name, { formatterSpec, parserSpec });\r\n } else {\r\n throw new Error(`Unable to find format properties for ${name} with persistence unit ${persistenceUnitName}`);\r\n }\r\n }\r\n}\r\n\r\n// ========================================================================================================================================\r\n// Default Data\r\n// ========================================================================================================================================\r\nconst DEFAULT_FORMATKEY_BY_UNIT_SYSTEM = [\r\n {\r\n system: \"metric\", // PresentationUnitSystem.Metric,\r\n entries: [\r\n { type: getQuantityTypeKey(QuantityType.Length), formatKey: \"[units:length]meter4\" },\r\n { type: getQuantityTypeKey(QuantityType.Angle), formatKey: \"[units:angle]degree2\" },\r\n { type: getQuantityTypeKey(QuantityType.Area), formatKey: \"[units:area]mSquared4\" },\r\n { type: getQuantityTypeKey(QuantityType.Volume), formatKey: \"[units:volume]mCubed4\" },\r\n { type: getQuantityTypeKey(QuantityType.LatLong), formatKey: \"[units:angle]dms\" },\r\n { type: getQuantityTypeKey(QuantityType.Coordinate), formatKey: \"[units:length]meter2\" },\r\n { type: getQuantityTypeKey(QuantityType.Stationing), formatKey: \"[units:length]m-sta2\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthSurvey), formatKey: \"[units:length]meter4\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: \"[units:length]meter4\" },\r\n ],\r\n },\r\n {\r\n system: \"imperial\", // PresentationUnitSystem.BritishImperial,\r\n entries: [\r\n { type: getQuantityTypeKey(QuantityType.Length), formatKey: \"[units:length]fi8\" },\r\n { type: getQuantityTypeKey(QuantityType.Angle), formatKey: \"[units:angle]dms2\" },\r\n { type: getQuantityTypeKey(QuantityType.Area), formatKey: \"[units:area]fSquared4\" },\r\n { type: getQuantityTypeKey(QuantityType.Volume), formatKey: \"[units:volume]fCubed4\" },\r\n { type: getQuantityTypeKey(QuantityType.LatLong), formatKey: \"[units:angle]dms\" },\r\n { type: getQuantityTypeKey(QuantityType.Coordinate), formatKey: \"[units:length]feet2\" },\r\n { type: getQuantityTypeKey(QuantityType.Stationing), formatKey: \"[units:length]f-sta2\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthSurvey), formatKey: \"[units:length]f-survey-4-labeled\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: \"[units:length]feet4\" },\r\n ],\r\n },\r\n {\r\n system: \"usCustomary\", // PresentationUnitSystem.UsCustomary\r\n entries: [\r\n { type: getQuantityTypeKey(QuantityType.Length), formatKey: \"[units:length]fi8\" },\r\n { type: getQuantityTypeKey(QuantityType.Angle), formatKey: \"[units:angle]dms2\" },\r\n { type: getQuantityTypeKey(QuantityType.Area), formatKey: \"[units:area]fSquared4\" },\r\n { type: getQuantityTypeKey(QuantityType.Volume), formatKey: \"[units:volume]fCubed4\" },\r\n { type: getQuantityTypeKey(QuantityType.LatLong), formatKey: \"[units:angle]dms\" },\r\n { type: getQuantityTypeKey(QuantityType.Coordinate), formatKey: \"[units:length]feet2\" },\r\n { type: getQuantityTypeKey(QuantityType.Stationing), formatKey: \"[units:length]f-sta2\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthSurvey), formatKey: \"[units:length]f-survey-4\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: \"[units:length]feet4\" },\r\n ],\r\n },\r\n {\r\n system: \"usSurvey\", // PresentationUnitSystem.UsSurvey\r\n entries: [\r\n { type: getQuantityTypeKey(QuantityType.Length), formatKey: \"[units:length]f-survey-4\" },\r\n { type: getQuantityTypeKey(QuantityType.Angle), formatKey: \"[units:angle]dms2\" },\r\n { type: getQuantityTypeKey(QuantityType.Area), formatKey: \"[units:area]usSurveyFtSquared4\" },\r\n { type: getQuantityTypeKey(QuantityType.Volume), formatKey: \"[units:volume]usSurveyFtCubed4\" },\r\n { type: getQuantityTypeKey(QuantityType.LatLong), formatKey: \"[units:angle]dms\" },\r\n { type: getQuantityTypeKey(QuantityType.Coordinate), formatKey: \"[units:length]f-survey-2\" },\r\n { type: getQuantityTypeKey(QuantityType.Stationing), formatKey: \"[units:length]f-survey-sta2\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthSurvey), formatKey: \"[units:length]f-survey-4\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: \"[units:length]f-survey-4\" },\r\n ],\r\n },\r\n];\r\n\r\n/** Interface used to define structure of default format definitions. */\r\ninterface UniqueFormatsProps {\r\n readonly key: string;\r\n readonly description?: string;\r\n readonly format: FormatProps;\r\n}\r\n\r\n/** List of default format definitions used by the Standard QuantityTypes. */\r\nconst DEFAULT_FORMATPROPS: UniqueFormatsProps[] = [\r\n {\r\n key: \"[units:length]meter4\",\r\n description: \"meters (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m\", name: \"Units.M\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]meter2\",\r\n description: \"meters (labeled) 2 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m\", name: \"Units.M\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n },\r\n },\r\n\r\n {\r\n key: \"[units:length]feet4\",\r\n description: \"feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]feet2\",\r\n description: \"feet (labeled) 2 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]fi8\",\r\n description: \"feet-inch 1/8 (labeled)\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"-\",\r\n units: [{ label: \"'\", name: \"Units.FT\" }, { label: \"\\\"\", name: \"Units.IN\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 8,\r\n type: \"Fractional\",\r\n uomSeparator: \"\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]f-sta2\",\r\n description: \"stationing feet-2 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.FT\" }],\r\n },\r\n formatTraits: [\"trailZeroes\", \"keepSingleZero\"],\r\n stationOffsetSize: 2,\r\n precision: 2,\r\n type: \"Station\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]f-survey-sta2\",\r\n description: \"stationing feet-2 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"trailZeroes\", \"keepSingleZero\"],\r\n stationOffsetSize: 2,\r\n precision: 2,\r\n type: \"Station\",\r\n },\r\n },\r\n\r\n {\r\n key: \"[units:length]m-sta2\",\r\n description: \"stationing meters-2 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m\", name: \"Units.M\" }],\r\n },\r\n formatTraits: [\"trailZeroes\", \"keepSingleZero\"],\r\n stationOffsetSize: 3,\r\n precision: 2,\r\n type: \"Station\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]f-survey-2\",\r\n description: \"survey feet (labeled)-2 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]f-survey-4-labeled\",\r\n description: \"survey feet (labeled)-4 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft (US Survey)\", name: \"Units.US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n\r\n {\r\n key: \"[units:length]f-survey-4\",\r\n description: \"survey feet (labeled)-4 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:angle]degree2\",\r\n description: \"degrees (labeled) 2 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"°\", name: \"Units.ARC_DEG\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n uomSeparator: \"\",\r\n },\r\n },\r\n {\r\n key: \"[units:angle]dms\",\r\n description: \"degrees minutes seconds (labeled) 0 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"°\", name: \"Units.ARC_DEG\" }, { label: \"'\", name: \"Units.ARC_MINUTE\" }, { label: \"\\\"\", name: \"Units.ARC_SECOND\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n uomSeparator: \"\",\r\n },\r\n },\r\n {\r\n key: \"[units:angle]dms2\",\r\n description: \"degrees minutes seconds (labeled) 2 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"°\", name: \"Units.ARC_DEG\" }, { label: \"'\", name: \"Units.ARC_MINUTE\" }, { label: \"\\\"\", name: \"Units.ARC_SECOND\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n uomSeparator: \"\",\r\n },\r\n },\r\n {\r\n key: \"[units:area]mSquared4\",\r\n description: \"square meters (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m²\", name: \"Units.SQ_M\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:area]fSquared4\",\r\n description: \"square feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft²\", name: \"Units.SQ_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:area]usSurveyFtSquared4\",\r\n description: \"square survey feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft²\", name: \"Units.SQ_US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:volume]mCubed4\",\r\n description: \"cubic meters (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m³\", name: \"Units.CUB_M\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:volume]fCubed4\",\r\n description: \"cubic feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft³\", name: \"Units.CUB_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:volume]usSurveyFtCubed4\",\r\n description: \"cubic survey feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft³\", name: \"Units.CUB_US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n];\r\n"]}
1
+ {"version":3,"file":"QuantityFormatter.js","sourceRoot":"","sources":["../../../src/quantity-formatting/QuantityFormatter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsGH,gDAKC;AAgDD,wEAEC;AA3JD,sDAA+E;AAC/E,wDAG8B;AAC9B,6EAA0E;AAC1E,4CAAyC;AAEzC,6DAAyF;AAGzF,oEAAoE;AAEpE;;;GAGG;AACH,IAAY,YAmBX;AAnBD,WAAY,YAAY;IACtB,6HAA6H;IAC7H,mDAAU,CAAA;IACV,8IAA8I;IAC9I,iDAAS,CAAA;IACT,wIAAwI;IACxI,+CAAQ,CAAA;IACR,8IAA8I;IAC9I,mDAAU,CAAA;IACV,4JAA4J;IAC5J,qDAAW,CAAA;IACX,yIAAyI;IACzI,2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,gBAAgB,EAAE,eAAe,CAAC;YACjD,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,SAAS;SAChB;KACF;IACD;QACE,GAAG,EAAE,uBAAuB;QAC5B,WAAW,EAAE,uCAAuC;QACpD,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;aAChD;YACD,YAAY,EAAE,CAAC,gBAAgB,EAAE,eAAe,CAAC;YACjD,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,SAAS;SAChB;KACF;IACD;QACE,GAAG,EAAE,gCAAgC;QACrC,WAAW,EAAE,8CAA8C;QAC3D,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;aAC1D;YACD,YAAY,EAAE,CAAC,gBAAgB,EAAE,eAAe,CAAC;YACjD,SAAS,EAAE,CAAC;YACZ,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormatting\r\n */\r\n\r\nimport { BeEvent, BentleyError, BeUiEvent, Logger } from \"@itwin/core-bentley\";\r\nimport {\r\n AlternateUnitLabelsProvider, Format, FormatDefinition, FormatProps, FormatsChangedArgs, FormatsProvider, FormatterSpec, ParseError, ParserSpec, QuantityParseResult,\r\n UnitConversionProps, UnitProps, UnitsProvider, UnitSystemKey,\r\n} from \"@itwin/core-quantity\";\r\nimport { FrontendLoggerCategory } from \"../common/FrontendLoggerCategory\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { BasicUnitsProvider, getDefaultAlternateUnitLabels } from \"./BasicUnitsProvider\";\r\nimport { CustomFormatPropEditorSpec } from \"./QuantityTypesEditorSpecs\";\r\n\r\n// cSpell:ignore FORMATPROPS FORMATKEY ussurvey uscustomary USCUSTOM\r\n\r\n/**\r\n * Defines standard format types for tools that need to display measurements to user.\r\n * @public\r\n */\r\nexport enum QuantityType {\r\n /** Length which is stored in meters. Typically formatted to display in meters or feet-inches based on active unit system. */\r\n Length = 1,\r\n /** Angular value which is stored in radians. Typically formatted to display degrees or Degrees-Minute-Seconds based on active unit system. */\r\n Angle = 2,\r\n /** Area value store in meters squared. Typically formatted to display in meters squared or feet squared based on active unit system. */\r\n Area = 3,\r\n /** Volume value which is stored in meters cubed. Typically formatted to display in meters cubed or feet cubed based on active unit system. */\r\n Volume = 4,\r\n /** LatLong is an angular value which is stored in radians. Typically formatted to display degrees or Degrees-Minute-Seconds based on active unit system. */\r\n LatLong = 5,\r\n /** Coordinate/Location value which is stored in meters. Typically formatted to display in meters or feet based on active unit system. */\r\n Coordinate = 6,\r\n /** Stationing is a distance value stored in meters. Typically formatted to display `xxx+xx` or `xx+xxx` based on active unit system. */\r\n Stationing = 7,\r\n /** LengthSurvey is a distance value stored in meters. Typically formatted to display in meters or US Survey Feet based on active unit system.. */\r\n LengthSurvey = 8,\r\n /** LengthEngineering is a distance value stored in meters. Typically formatted to display either meters or feet based on active unit system. */\r\n LengthEngineering = 9\r\n}\r\n\r\n/**\r\n * Used to uniquely identify the type or quantity. [[QuantityType]] are built-in types and `string` are used for custom quantity types.\r\n * @public\r\n */\r\nexport type QuantityTypeArg = QuantityType | string;\r\n\r\n/** String used to uniquely identify a QuantityType in the quantity registry. See function [[QuantityType.getQuantityTypeKey]].\r\n * @public\r\n */\r\nexport type QuantityTypeKey = string;\r\n\r\n/** String used to uniquely identify a UnitProp.\r\n * @public\r\n */\r\nexport type UnitNameKey = string;\r\n\r\n/**\r\n * Interface for the properties required to create a FormatterSpec or ParserSpec.\r\n * @beta\r\n */\r\nexport interface CreateFormattingSpecProps {\r\n /** The name of the persistence unit. */\r\n persistenceUnitName: string;\r\n /** The format properties to use for the spec. */\r\n formatProps: FormatProps;\r\n /** Optional name for the format. */\r\n formatName?: string;\r\n}\r\n\r\n/**\r\n * Class that contains alternate Unit Labels. These labels are used when parsing strings to quantities.\r\n * One use case is to allow a \"^\", which is easily input, to be used to specify \"°\".\r\n * @internal\r\n */\r\nexport class AlternateUnitLabelsRegistry implements AlternateUnitLabelsProvider {\r\n private _alternateLabelRegistry = new Map<UnitNameKey, Set<string>>();\r\n\r\n public addAlternateLabels(key: UnitNameKey, ...labels: string[]) {\r\n [...labels].forEach((value) => this._alternateLabelRegistry.get(key)?.add(value));\r\n }\r\n\r\n constructor(defaultAlternates?: Map<UnitNameKey, Set<string>>) {\r\n if (defaultAlternates) {\r\n this._alternateLabelRegistry = defaultAlternates;\r\n }\r\n }\r\n\r\n public getAlternateUnitLabels(unit: UnitProps): string[] | undefined {\r\n const key: UnitNameKey = unit.name;\r\n const labels = this._alternateLabelRegistry.get(key);\r\n if (labels)\r\n return [...labels.values()];\r\n\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Function to return a QuantityTypeKey given either a QuantityType enum value or a string. This allows caching and\r\n * retrieving standard and custom quantity types.\r\n * @public\r\n */\r\nexport function getQuantityTypeKey(type: QuantityTypeArg): QuantityTypeKey {\r\n // For QuantityType enum values, build a string that shouldn't collide with anything a user may come up with\r\n if (typeof type === \"number\")\r\n return `QuantityTypeEnumValue-${type.toString()}`;\r\n return type;\r\n}\r\n\r\n/**\r\n * This interface supplies the definition of a `standard` quantity type that is registered with the QuantityFormatter.\r\n * A `standard` quantity type could be one of the nine delivered QuantityTypes or a CustomQuantityTypeDefinition.\r\n * @public\r\n */\r\nexport interface QuantityTypeDefinition {\r\n /** String used as a key to look up the quantity type. If defining a [[CustomQuantityTypeDefinition]] the QuantityTypeKey\r\n * should match the QuantityTypeArg. */\r\n readonly key: QuantityTypeKey;\r\n /** The type value which can be one of the standard QuantityType enum values or a unique string if defining a custom type. */\r\n readonly type: QuantityTypeArg;\r\n /** The unit that the magnitude of the quantity is stored ie. (Meter for Length and Radian for Angle). The persistence unit is\r\n * also used during formatting if the FormatProps does not define one or more composite units. */\r\n readonly persistenceUnit: UnitProps;\r\n /** Localized label to display in UI */\r\n label: string;\r\n /** Localized description that may be used to provide detailed description for the Quantity type. */\r\n description: string;\r\n /* Provide a default FormatProps for a unit system. */\r\n getDefaultFormatPropsBySystem: (requestedSystem: UnitSystemKey) => FormatProps;\r\n /** Async function to generate a [FormatterSpec]$(core-quantity) that will be called to format values.*/\r\n generateFormatterSpec: (formatProps: FormatProps, unitsProvider: UnitsProvider) => Promise<FormatterSpec>;\r\n /** Async function to generate a [ParserSpec]$(core-quantity) that will be called to parse a string into a quantity value.*/\r\n generateParserSpec: (formatProps: FormatProps, unitsProvider: UnitsProvider, alternateUnitLabelsProvider?: AlternateUnitLabelsProvider) => Promise<ParserSpec>;\r\n}\r\n\r\n/** CustomQuantityTypeDefinition interface is used to define a Custom quantity type that can be registered with the [[QuantityFormatter]].\r\n * A custom quantity formatter must be able to generate a FormatterSpec and ParserSpec that will be called to format and parse values.\r\n * Optionally it can provide specification of custom properties that it will use to define any formatting options. CustomQuantityTypeDefinitions\r\n * must be registered with the [[QuantityFormatter]] using the method `IModelApp.quantityFormatter.registerQuantityType`.\r\n * @public\r\n */\r\nexport interface CustomQuantityTypeDefinition extends QuantityTypeDefinition {\r\n /** Return true if the FormatProps have the necessary `custom` property definition */\r\n isCompatibleFormatProps: (formatProps: FormatProps) => boolean;\r\n /** An array of specifications that are used to generate a label and editor in the UI used to display and edit the FormatProps.\r\n * UI items defined as primary will be shown higher in the list of UI components. */\r\n primaryPropEditorSpecs?: CustomFormatPropEditorSpec[];\r\n /** An array of specifications that are used to generate a label and editor in the UI used to display and edit the FormatProps.\r\n * UI items defined as secondary will be shown below other UI components that edit FormatProps. */\r\n secondaryPropEditorSpecs?: CustomFormatPropEditorSpec[];\r\n}\r\n\r\n/** CustomQuantityTypeDefinition type guard.\r\n * @public\r\n*/\r\nexport function isCustomQuantityTypeDefinition(item: QuantityTypeDefinition): item is CustomQuantityTypeDefinition {\r\n return !!(item as CustomQuantityTypeDefinition).isCompatibleFormatProps;\r\n}\r\n\r\n/** private class to hold standard quantity definitions as defined by QuantityType enum and implement QuantityTypeDefinition interface */\r\nclass StandardQuantityTypeDefinition implements QuantityTypeDefinition {\r\n private _label: string | undefined;\r\n private _description: string | undefined;\r\n private _key: string;\r\n\r\n constructor(public type: QuantityType, public persistenceUnit: UnitProps, private _labelKey: string, private _descriptionKey: string) {\r\n this._key = getQuantityTypeKey(type);\r\n }\r\n\r\n public get key(): string { return this._key; }\r\n\r\n public get label(): string {\r\n if (!this._label) {\r\n this._label = IModelApp.localization.getLocalizedString(this._labelKey);\r\n }\r\n return this._label ?? \"\";\r\n }\r\n\r\n public get description(): string {\r\n if (!this._description) {\r\n this._description = IModelApp.localization.getLocalizedString(this._descriptionKey);\r\n }\r\n return this._description ?? this.label;\r\n }\r\n\r\n /** Get a default format to show quantity in persistence unit with precision or 6 decimal places. */\r\n public getDefaultFormatPropsBySystem(requestedSystem: UnitSystemKey): FormatProps {\r\n // Fallback same as Format \"DefaultRealU\" in Formats ecschema\r\n const fallbackProps: FormatProps = {\r\n formatTraits: [\"keepSingleZero\", \"keepDecimalPoint\", \"showUnitLabel\"],\r\n precision: 6,\r\n type: \"Decimal\",\r\n uomSeparator: \" \",\r\n decimalSeparator: \".\",\r\n };\r\n\r\n const defaultUnitSystemData = DEFAULT_FORMATKEY_BY_UNIT_SYSTEM.find((value) => value.system === requestedSystem);\r\n if (defaultUnitSystemData) {\r\n const defaultFormatEntry = defaultUnitSystemData.entries.find((value) => value.type === this.key);\r\n if (defaultFormatEntry) {\r\n const defaultFormatPropsEntry = DEFAULT_FORMATPROPS.find((props) => props.key === defaultFormatEntry.formatKey);\r\n if (defaultFormatPropsEntry)\r\n return defaultFormatPropsEntry.format;\r\n }\r\n }\r\n\r\n return fallbackProps;\r\n }\r\n\r\n public async generateFormatterSpec(formatProps: FormatProps, unitsProvider: UnitsProvider): Promise<FormatterSpec> {\r\n const format = await Format.createFromJSON(this.key, unitsProvider, formatProps);\r\n return FormatterSpec.create(format.name, format, unitsProvider, this.persistenceUnit);\r\n }\r\n\r\n public async generateParserSpec(formatProps: FormatProps, unitsProvider: UnitsProvider, alternateUnitLabelsProvider?: AlternateUnitLabelsProvider) {\r\n const format = await Format.createFromJSON(this.key, unitsProvider, formatProps);\r\n return ParserSpec.create(format, unitsProvider, this.persistenceUnit, alternateUnitLabelsProvider);\r\n }\r\n}\r\n\r\n/** Override format entries can define formats for any of the different unit systems.\r\n * @public\r\n */\r\nexport interface OverrideFormatEntry {\r\n /** Override format for \"imperial\" unit system */\r\n imperial?: FormatProps;\r\n /** Override format for \"metric\" unit system */\r\n metric?: FormatProps;\r\n /** Override format for \"usCustomary\" unit system */\r\n usCustomary?: FormatProps;\r\n /** Override format for \"usSurvey\" unit system */\r\n usSurvey?: FormatProps;\r\n}\r\n\r\n/**\r\n * Entries returned when looking up specs from the [[QuantityFormatter._formatSpecsRegistry]]\r\n * @beta\r\n */\r\nexport interface FormattingSpecEntry {\r\n formatterSpec: FormatterSpec;\r\n parserSpec: ParserSpec;\r\n}\r\n/** Interface that defines the functions required to be implemented to provide custom formatting and parsing of a custom quantity type.\r\n * @public\r\n */\r\nexport interface FormatterParserSpecsProvider {\r\n /** Custom quantity id */\r\n quantityType: QuantityTypeArg;\r\n /** Async function to return FormatterSpec for a custom quantity type */\r\n createFormatterSpec: (unitSystem: UnitSystemKey) => Promise<FormatterSpec>;\r\n /** Async function to return ParserSpec for a custom quantity type */\r\n createParserSpec: (unitSystem: UnitSystemKey) => Promise<ParserSpec>;\r\n}\r\n\r\n/** Arguments sent to FormattingUnitSystemChanged event listeners.\r\n * @public\r\n */\r\nexport interface FormattingUnitSystemChangedArgs {\r\n /** string that defines unit system activated. */\r\n readonly system: UnitSystemKey;\r\n}\r\n\r\n/** Arguments sent to QuantityFormatsChanged event listeners.\r\n * @public\r\n */\r\nexport interface QuantityFormatsChangedArgs {\r\n /** string that represents the QuantityType that has been overriden or the overrides cleared. */\r\n readonly quantityType: string;\r\n}\r\n\r\n/** Arguments sent to [[UnitFormattingSettingsProvider]] when overrides are changed.\r\n * @public\r\n */\r\nexport interface QuantityFormatOverridesChangedArgs {\r\n /** string that represents the QuantityType that has been overriden or the overrides cleared. */\r\n readonly typeKey: QuantityTypeKey;\r\n /** overrideEntry will be undefined when clearing overrides */\r\n readonly overrideEntry?: OverrideFormatEntry;\r\n /** used only when change applies to a single unit system */\r\n readonly unitSystem?: UnitSystemKey;\r\n}\r\n\r\n/**\r\n * The UnitFormattingSettingsProvider interface is used to store and retrieve override FormatProps and Presentation Unit System\r\n * for use by the QuantityFormatter. If no UnitFormattingSettingsProvider is supplied to the QuantityFormatter then any overrides\r\n * set are lost when the session is closed. The `ui-test-app` has and example implementation that uses browser local storage via the\r\n * class [[LocalUnitFormatProvider]] [here](https://github.com/iTwin/itwinjs-core/blob/d341e030d4c1427effd80ea54b3d57fec8ad1bc1/test-apps/ui-test-app/src/frontend/index.tsx#L315).\r\n * @public\r\n */\r\nexport interface UnitFormattingSettingsProvider {\r\n /** serializes JSON object containing format overrides for a specific quantity type. */\r\n store(quantityTypeKey: QuantityTypeKey, overrideProps: OverrideFormatEntry): Promise<boolean>;\r\n /** retrieves serialized JSON object containing format overrides for a specific quantity type. */\r\n retrieve(quantityTypeKey: QuantityTypeKey): Promise<OverrideFormatEntry | undefined>;\r\n /** removes the override formats for a specific quantity type. */\r\n remove(quantityTypeKey: QuantityTypeKey): Promise<boolean>;\r\n /** retrieves the active unit system typically based on the \"active\" iModelConnection */\r\n retrieveUnitSystem(defaultKey: UnitSystemKey): Promise<UnitSystemKey>;\r\n /** store the active unit system typically for the \"active\" iModelConnection */\r\n storeUnitSystemKey(unitSystemKey: UnitSystemKey): Promise<boolean>;\r\n /** Function to load overrides for a specific IModelConnection. Typically this is not called often since typical\r\n * implementations monitor for IModelConnection changes and call this method internally. */\r\n loadOverrides(imodel: IModelConnection | undefined): Promise<void>;\r\n /** function called to save changes to Presentation Unit System */\r\n storeUnitSystemSetting(args: FormattingUnitSystemChangedArgs): Promise<void>;\r\n /** function called to save format overrides */\r\n storeFormatOverrides(args: QuantityFormatOverridesChangedArgs): Promise<void>;\r\n /** property that is set by the implementation to inform the BaseUnitFormattingSettingsProvider if the provider\r\n * should trigger reloading of the overrides when the \"active\" imodel changes. */\r\n readonly maintainOverridesPerIModel: boolean;\r\n}\r\n\r\n/**\r\n * A default formatsProvider, that provides a limited set of [[FormatDefinition]], associated to a few [[KindOfQuantity]].\r\n * Maps each KindOfQuantity to a [[QuantityType]].\r\n * When retrieving a valid [[KindOfQuantity]], returns the [[FormatProps]] for the associated [[QuantityType]].\r\n * @internal\r\n */\r\nexport class QuantityTypeFormatsProvider implements FormatsProvider {\r\n public onFormatsChanged = new BeEvent<(args: FormatsChangedArgs) => void>();\r\n private _removeListeners: (() => void)[] = [];\r\n public constructor() {\r\n this._removeListeners.push(IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(() => {\r\n this.onFormatsChanged.raiseEvent({ formatsChanged: \"all\" });\r\n }));\r\n }\r\n\r\n public [Symbol.dispose]() {\r\n this._removeListeners.forEach(listener => listener());\r\n }\r\n\r\n private _kindOfQuantityMap = new Map<string, QuantityType>([\r\n [\"DefaultToolsUnits.LENGTH\", QuantityType.Length],\r\n [\"DefaultToolsUnits.ANGLE\", QuantityType.Angle],\r\n [\"DefaultToolsUnits.AREA\", QuantityType.Area],\r\n [\"DefaultToolsUnits.VOLUME\", QuantityType.Volume],\r\n [\"DefaultToolsUnits.LENGTH_COORDINATE\", QuantityType.Coordinate],\r\n [\"CivilUnits.STATION\", QuantityType.Stationing],\r\n [\"CivilUnits.LENGTH\", QuantityType.LengthSurvey],\r\n [\"AecUnits.LENGTH\", QuantityType.LengthEngineering]\r\n ]);\r\n\r\n public async getFormat(name: string): Promise<FormatDefinition | undefined> {\r\n const quantityType = this._kindOfQuantityMap.get(name);\r\n if (!quantityType) return undefined;\r\n\r\n return IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n }\r\n}\r\n\r\n/**\r\n * An implementation of the [[FormatsProvider]] interface that forwards calls to getFormats to the underlying FormatsProvider.\r\n * Also fires the onFormatsChanged event when the underlying FormatsProvider fires its own onFormatsChanged event.\r\n * @internal\r\n */\r\nexport class FormatsProviderManager implements FormatsProvider {\r\n public onFormatsChanged = new BeEvent<(args: FormatsChangedArgs) => void>();\r\n\r\n constructor(private _formatsProvider: FormatsProvider) {\r\n this._formatsProvider.onFormatsChanged.addListener((args: FormatsChangedArgs) => {\r\n this.onFormatsChanged.raiseEvent(args);\r\n });\r\n }\r\n\r\n public async getFormat(name: string): Promise<FormatDefinition | undefined> {\r\n return this._formatsProvider.getFormat(name);\r\n }\r\n\r\n public get formatsProvider(): FormatsProvider { return this; }\r\n\r\n public set formatsProvider(formatsProvider: FormatsProvider) {\r\n this._formatsProvider = formatsProvider;\r\n this._formatsProvider.onFormatsChanged.addListener((args: FormatsChangedArgs) => {\r\n this.onFormatsChanged.raiseEvent(args);\r\n });\r\n this.onFormatsChanged.raiseEvent({ formatsChanged: \"all\" });\r\n }\r\n}\r\n/** Class that supports formatting quantity values into strings and parsing strings into quantity values. This class also maintains\r\n * the \"active\" unit system and caches FormatterSpecs and ParserSpecs for the \"active\" unit system to allow synchronous access to\r\n * parsing and formatting values. The support unit systems are defined by [[UnitSystemKey]] and is kept in synch with the unit systems\r\n * provided by the Presentation Manager on the backend. The QuantityFormatter contains a registry of quantity type definitions. These definitions implement\r\n * the [[QuantityTypeDefinition]] interface, which among other things, provide default [[FormatProps]], and provide methods\r\n * to generate both a [[FormatterSpec]] and a [[ParserSpec]]. There are built-in quantity types that are\r\n * identified by the [[QuantityType]] enum. [[CustomQuantityTypeDefinition]] can be registered to extend the available quantity types available\r\n * by frontend tools. The QuantityFormatter also allows the default formats to be overriden.\r\n *\r\n * @public\r\n */\r\nexport class QuantityFormatter implements UnitsProvider {\r\n private _unitsProvider: UnitsProvider = new BasicUnitsProvider();\r\n private _alternateUnitLabelsRegistry = new AlternateUnitLabelsRegistry(getDefaultAlternateUnitLabels());\r\n /** Registry containing available quantity type definitions. */\r\n protected _quantityTypeRegistry: Map<QuantityTypeKey, QuantityTypeDefinition> = new Map<QuantityTypeKey, QuantityTypeDefinition>();\r\n /** Registry containing available FormatterSpec and ParserSpec, mapped by keys.\r\n * @beta\r\n */\r\n protected _formatSpecsRegistry: Map<string, FormattingSpecEntry> = new Map<string, FormattingSpecEntry>();\r\n\r\n /** Active UnitSystem key - must be one of \"imperial\", \"metric\", \"usCustomary\", or \"usSurvey\". */\r\n protected _activeUnitSystem: UnitSystemKey = \"imperial\";\r\n /** Map of FormatSpecs for all available QuantityTypes and the active Unit System */\r\n protected _activeFormatSpecsByType = new Map<QuantityTypeKey, FormatterSpec>();\r\n /** Map of ParserSpecs for all available QuantityTypes and the active Unit System */\r\n protected _activeParserSpecsByType = new Map<QuantityTypeKey, ParserSpec>();\r\n /** Map of FormatSpecs that have been overriden from the default. */\r\n protected _overrideFormatPropsByUnitSystem = new Map<UnitSystemKey, Map<QuantityTypeKey, FormatProps>>();\r\n /** Optional object that gets called to store and retrieve format overrides. */\r\n protected _unitFormattingSettingsProvider: UnitFormattingSettingsProvider | undefined;\r\n\r\n /** Set the settings provider and if not iModel specific initialize setting for user. */\r\n public async setUnitFormattingSettingsProvider(provider: UnitFormattingSettingsProvider) {\r\n this._unitFormattingSettingsProvider = provider;\r\n if (!provider.maintainOverridesPerIModel)\r\n await provider.loadOverrides(undefined);\r\n }\r\n\r\n /** Called after the active unit system is changed.\r\n * The system will report the UnitSystemKey/name of the the system that was activated.\r\n */\r\n public readonly onActiveFormattingUnitSystemChanged = new BeUiEvent<FormattingUnitSystemChangedArgs>();\r\n\r\n /** Called when the format of a QuantityType is overriden or the override is cleared. The string returned will\r\n * be a QuantityTypeKey generated by method `getQuantityTypeKey`.\r\n */\r\n public readonly onQuantityFormatsChanged = new BeUiEvent<QuantityFormatsChangedArgs>();\r\n\r\n /** Fired when the active UnitsProvider is updated. This will allow cached Formatter and Parser specs to be updated if necessary. */\r\n public readonly onUnitsProviderChanged = new BeUiEvent<void>();\r\n\r\n private _removeFormatsProviderListener?: () => void;\r\n /**\r\n * constructor\r\n * @param showMetricOrUnitSystem - Pass in `true` to show Metric formatted quantity values. Defaults to Imperial. To explicitly\r\n * set it to a specific unit system pass a UnitSystemKey.\r\n */\r\n constructor(showMetricOrUnitSystem?: boolean | UnitSystemKey) {\r\n if (undefined !== showMetricOrUnitSystem) {\r\n if (typeof showMetricOrUnitSystem === \"boolean\")\r\n this._activeUnitSystem = showMetricOrUnitSystem ? \"metric\" : \"imperial\";\r\n else\r\n this._activeUnitSystem = showMetricOrUnitSystem;\r\n }\r\n }\r\n\r\n public [Symbol.dispose](): void {\r\n if (this._removeFormatsProviderListener) {\r\n this._removeFormatsProviderListener();\r\n this._removeFormatsProviderListener = undefined;\r\n }\r\n }\r\n\r\n private getOverrideFormatPropsByQuantityType(quantityTypeKey: QuantityTypeKey, unitSystem?: UnitSystemKey): FormatProps | undefined {\r\n const requestedUnitSystem = unitSystem ?? this.activeUnitSystem;\r\n const overrideMap = this._overrideFormatPropsByUnitSystem.get(requestedUnitSystem);\r\n if (!overrideMap)\r\n return undefined;\r\n\r\n return overrideMap.get(quantityTypeKey);\r\n }\r\n\r\n /** Method used to register all QuantityTypes defined in QuantityType enum. */\r\n protected async initializeQuantityTypesRegistry() {\r\n // QuantityType.Length\r\n const lengthUnit = await this.findUnitByName(\"Units.M\");\r\n const lengthDefinition = new StandardQuantityTypeDefinition(QuantityType.Length, lengthUnit,\r\n \"iModelJs:QuantityType.Length.label\", \"iModelJs:QuantityType.Length.description\");\r\n this._quantityTypeRegistry.set(lengthDefinition.key, lengthDefinition);\r\n\r\n // QuantityType.LengthEngineering\r\n const lengthEngineeringDefinition = new StandardQuantityTypeDefinition(QuantityType.LengthEngineering, lengthUnit,\r\n \"iModelJs:QuantityType.LengthEngineering.label\", \"iModelJs:QuantityType.LengthEngineering.description\");\r\n this._quantityTypeRegistry.set(lengthEngineeringDefinition.key, lengthEngineeringDefinition);\r\n\r\n // QuantityType.Coordinate\r\n const coordinateDefinition = new StandardQuantityTypeDefinition(QuantityType.Coordinate, lengthUnit,\r\n \"iModelJs:QuantityType.Coordinate.label\", \"iModelJs:QuantityType.Coordinate.description\");\r\n this._quantityTypeRegistry.set(coordinateDefinition.key, coordinateDefinition);\r\n\r\n // QuantityType.Stationing\r\n const stationingDefinition = new StandardQuantityTypeDefinition(QuantityType.Stationing, lengthUnit,\r\n \"iModelJs:QuantityType.Stationing.label\", \"iModelJs:QuantityType.Stationing.description\");\r\n this._quantityTypeRegistry.set(stationingDefinition.key, stationingDefinition);\r\n\r\n // QuantityType.LengthSurvey\r\n const lengthSurveyDefinition = new StandardQuantityTypeDefinition(QuantityType.LengthSurvey, lengthUnit,\r\n \"iModelJs:QuantityType.LengthSurvey.label\", \"iModelJs:QuantityType.LengthSurvey.description\");\r\n this._quantityTypeRegistry.set(lengthSurveyDefinition.key, lengthSurveyDefinition);\r\n\r\n // QuantityType.Angle\r\n const radUnit = await this.findUnitByName(\"Units.RAD\");\r\n const angleDefinition = new StandardQuantityTypeDefinition(QuantityType.Angle, radUnit,\r\n \"iModelJs:QuantityType.Angle.label\", \"iModelJs:QuantityType.Angle.description\");\r\n this._quantityTypeRegistry.set(angleDefinition.key, angleDefinition);\r\n\r\n // QuantityType.LatLong\r\n const latLongDefinition = new StandardQuantityTypeDefinition(QuantityType.LatLong, radUnit,\r\n \"iModelJs:QuantityType.LatLong.label\", \"iModelJs:QuantityType.LatLong.description\");\r\n this._quantityTypeRegistry.set(latLongDefinition.key, latLongDefinition);\r\n\r\n // QuantityType.Area\r\n const sqMetersUnit = await this.findUnitByName(\"Units.SQ_M\");\r\n const areaDefinition = new StandardQuantityTypeDefinition(QuantityType.Area, sqMetersUnit,\r\n \"iModelJs:QuantityType.Area.label\", \"iModelJs:QuantityType.Area.description\");\r\n this._quantityTypeRegistry.set(areaDefinition.key, areaDefinition);\r\n\r\n // QuantityType.Volume\r\n const cubicMetersUnit = await this.findUnitByName(\"Units.CUB_M\");\r\n const volumeDefinition = new StandardQuantityTypeDefinition(QuantityType.Volume, cubicMetersUnit,\r\n \"iModelJs:QuantityType.Volume.label\", \"iModelJs:QuantityType.Volume.description\");\r\n this._quantityTypeRegistry.set(volumeDefinition.key, volumeDefinition);\r\n }\r\n\r\n /** Asynchronous call to load Formatting and ParsingSpecs for a unit system. This method ends up caching FormatterSpecs and ParserSpecs\r\n * so they can be quickly accessed.\r\n * @internal public for unit test usage\r\n */\r\n protected async loadFormatAndParsingMapsForSystem(systemType?: UnitSystemKey): Promise<void> {\r\n const systemKey = (undefined !== systemType) ? systemType : this._activeUnitSystem;\r\n const formatPropsByType = new Map<QuantityTypeDefinition, FormatProps>();\r\n\r\n // load cache for every registered QuantityType\r\n for (const [_, entry] of this.quantityTypesRegistry) {\r\n formatPropsByType.set(entry, this.getFormatPropsByQuantityTypeEntryAndSystem(entry, systemKey));\r\n };\r\n\r\n for (const [entry, formatProps] of formatPropsByType) {\r\n await this.loadFormatAndParserSpec(entry, formatProps);\r\n }\r\n }\r\n\r\n private getFormatPropsByQuantityTypeEntryAndSystem(quantityEntry: QuantityTypeDefinition, requestedSystem: UnitSystemKey, ignoreOverrides?: boolean): FormatProps {\r\n if (!ignoreOverrides) {\r\n const overrideProps = this.getOverrideFormatPropsByQuantityType(quantityEntry.key, requestedSystem);\r\n if (overrideProps)\r\n return overrideProps;\r\n }\r\n\r\n return quantityEntry.getDefaultFormatPropsBySystem(requestedSystem);\r\n }\r\n\r\n private async loadFormatAndParserSpec(quantityTypeDefinition: QuantityTypeDefinition, formatProps: FormatProps) {\r\n const formatterSpec = await quantityTypeDefinition.generateFormatterSpec(formatProps, this.unitsProvider);\r\n const parserSpec = await quantityTypeDefinition.generateParserSpec(formatProps, this.unitsProvider, this.alternateUnitLabelsProvider);\r\n this._activeFormatSpecsByType.set(quantityTypeDefinition.key, formatterSpec);\r\n this._activeParserSpecsByType.set(quantityTypeDefinition.key, parserSpec);\r\n }\r\n\r\n // repopulate formatSpec and parserSpec entries using only default format\r\n private async loadDefaultFormatAndParserSpecForQuantity(typeKey: QuantityTypeKey) {\r\n const quantityTypeDefinition = this.quantityTypesRegistry.get(typeKey);\r\n if (!quantityTypeDefinition)\r\n throw new Error(`Unable to locate QuantityType by key ${typeKey}`);\r\n\r\n const defaultFormat = quantityTypeDefinition.getDefaultFormatPropsBySystem(this.activeUnitSystem);\r\n await this.loadFormatAndParserSpec(quantityTypeDefinition, defaultFormat);\r\n }\r\n\r\n private async setOverrideFormatsByQuantityTypeKey(typeKey: QuantityTypeKey, overrideEntry: OverrideFormatEntry) {\r\n // extract overrides and insert into appropriate override map entry\r\n Object.keys(overrideEntry).forEach((systemKey) => {\r\n const unitSystemKey = systemKey as UnitSystemKey;\r\n const props = overrideEntry[unitSystemKey];\r\n if (props) {\r\n if (this._overrideFormatPropsByUnitSystem.has(unitSystemKey)) {\r\n // We just verified that unitSystemKey is present.\r\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\r\n this._overrideFormatPropsByUnitSystem.get(unitSystemKey)!.set(typeKey, props);\r\n } else {\r\n const newMap = new Map<string, FormatProps>();\r\n newMap.set(typeKey, props);\r\n this._overrideFormatPropsByUnitSystem.set(unitSystemKey, newMap);\r\n }\r\n }\r\n });\r\n\r\n await this._unitFormattingSettingsProvider?.storeFormatOverrides({ typeKey, overrideEntry });\r\n\r\n const formatProps = this.getOverrideFormatPropsByQuantityType(typeKey, this.activeUnitSystem);\r\n if (formatProps) {\r\n const typeEntry = this.quantityTypesRegistry.get(typeKey);\r\n if (typeEntry) {\r\n await this.loadFormatAndParserSpec(typeEntry, formatProps);\r\n // trigger a message to let callers know the format has changed.\r\n this.onQuantityFormatsChanged.emit({ quantityType: typeKey });\r\n }\r\n }\r\n }\r\n\r\n /** Method called to clear override and restore defaults formatter and parser spec */\r\n private async clearOverrideFormatsByQuantityTypeKey(type: QuantityTypeKey) {\r\n const unitSystem = this.activeUnitSystem;\r\n if (this.getOverrideFormatPropsByQuantityType(type, unitSystem)) {\r\n const overrideMap = this._overrideFormatPropsByUnitSystem.get(unitSystem);\r\n if (overrideMap && overrideMap.has(type)) {\r\n overrideMap.delete(type);\r\n await this._unitFormattingSettingsProvider?.storeFormatOverrides({ typeKey: type, unitSystem });\r\n\r\n await this.loadDefaultFormatAndParserSpecForQuantity(type);\r\n // trigger a message to let callers know the format has changed.\r\n this.onQuantityFormatsChanged.emit({ quantityType: type });\r\n }\r\n }\r\n }\r\n\r\n /** This method is called during IModelApp initialization to load the standard quantity types into the registry and to initialize the cache.\r\n * @internal\r\n */\r\n public async onInitialized() {\r\n await this.initializeQuantityTypesRegistry();\r\n\r\n const initialKoQs = [[\"DefaultToolsUnits.LENGTH\", \"Units.M\"], [\"DefaultToolsUnits.ANGLE\", \"Units.RAD\"], [\"DefaultToolsUnits.AREA\", \"Units.SQ_M\"], [\"DefaultToolsUnits.VOLUME\", \"Units.CUB_M\"], [\"DefaultToolsUnits.LENGTH_COORDINATE\", \"Units.M\"], [\"CivilUnits.STATION\", \"Units.M\"], [\"CivilUnits.LENGTH\", \"Units.M\"], [\"AecUnits.LENGTH\", \"Units.M\"]];\r\n for (const entry of initialKoQs) {\r\n try {\r\n await this.addFormattingSpecsToRegistry(entry[0], entry[1]);\r\n } catch (err: any) {\r\n Logger.logWarning(`${FrontendLoggerCategory.Package}.QuantityFormatter`, err.toString());\r\n }\r\n }\r\n this._removeFormatsProviderListener = IModelApp.formatsProvider.onFormatsChanged.addListener(async (args: FormatsChangedArgs) => {\r\n if (args.formatsChanged === \"all\") {\r\n for (const [name, entry] of this._formatSpecsRegistry.entries()) {\r\n const formatProps = await IModelApp.formatsProvider.getFormat(name);\r\n if (formatProps) {\r\n const persistenceUnitName = entry.formatterSpec.persistenceUnit.name;\r\n await this.addFormattingSpecsToRegistry(name, persistenceUnitName, formatProps);\r\n } else {\r\n this._formatSpecsRegistry.delete(name); // clear the specs if format was removed, or no longer exists.\r\n }\r\n }\r\n } else {\r\n for (const name of args.formatsChanged) {\r\n if (this._formatSpecsRegistry.has(name)) {\r\n const formatProps = await IModelApp.formatsProvider.getFormat(name);\r\n if (formatProps) {\r\n const existingEntry = this._formatSpecsRegistry.get(name);\r\n if (existingEntry) {\r\n const persistenceUnitName = existingEntry.formatterSpec.persistenceUnit.name;\r\n await this.addFormattingSpecsToRegistry(name, persistenceUnitName, formatProps);\r\n }\r\n } else {\r\n this._formatSpecsRegistry.delete(name);\r\n }\r\n }\r\n }\r\n }\r\n });\r\n\r\n // initialize default format and parsing specs\r\n await this.loadFormatAndParsingMapsForSystem();\r\n }\r\n\r\n /** Return a map that serves as a registry of all standard and custom quantity types. */\r\n public get quantityTypesRegistry() {\r\n return this._quantityTypeRegistry;\r\n }\r\n\r\n /** Return the class the contain map of all alternate labels for units. These alternate labels are used when parsing strings in quantity values. */\r\n public get alternateUnitLabelsProvider(): AlternateUnitLabelsProvider {\r\n return this._alternateUnitLabelsRegistry;\r\n }\r\n\r\n /**\r\n * Add one or more alternate labels for a unit - these labels are used during string parsing.\r\n * @param key UnitNameKey which comes from `UnitProps.name`\r\n * @param labels one or more unit labels\r\n */\r\n public addAlternateLabels(key: UnitNameKey, ...labels: string[]) {\r\n this._alternateUnitLabelsRegistry.addAlternateLabels(key, ...labels);\r\n this.onUnitsProviderChanged.emit();\r\n }\r\n\r\n /** Get/Set the active UnitsProvider class. */\r\n public get unitsProvider() {\r\n return this._unitsProvider;\r\n }\r\n\r\n public set unitsProvider(unitsProvider: UnitsProvider) {\r\n this.setUnitsProvider(unitsProvider); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }\r\n\r\n /** async method to set a units provider and reload caches */\r\n public async setUnitsProvider(unitsProvider: UnitsProvider) {\r\n this._unitsProvider = unitsProvider;\r\n\r\n try {\r\n // force all cached data to be reinitialized\r\n await IModelApp.quantityFormatter.onInitialized();\r\n } catch(err) {\r\n Logger.logWarning(`${FrontendLoggerCategory.Package}.quantityFormatter`, BentleyError.getErrorMessage(err), BentleyError.getErrorMetadata(err));\r\n Logger.logWarning(`${FrontendLoggerCategory.Package}.quantityFormatter`, \"An exception occurred initializing the iModelApp.quantityFormatter with the given UnitsProvider. Defaulting back to the internal units provider.\");\r\n // If there is a problem initializing with the given provider, default back to the internal provider\r\n await IModelApp.quantityFormatter.resetToUseInternalUnitsProvider();\r\n return;\r\n }\r\n\r\n // force default tool to start so any tool that may be using cached data will not be using bad data.\r\n if (IModelApp.toolAdmin)\r\n await IModelApp.toolAdmin.startDefaultTool();\r\n this.onUnitsProviderChanged.emit();\r\n }\r\n\r\n /** Async call typically used after IModel is closed to reset UnitsProvider to default one that does not require an Units schema. */\r\n public async resetToUseInternalUnitsProvider() {\r\n if (this._unitsProvider instanceof BasicUnitsProvider)\r\n return;\r\n\r\n await this.setUnitsProvider(new BasicUnitsProvider());\r\n }\r\n\r\n /** Async call to register a CustomQuantityType and load the FormatSpec and ParserSpec for the new type. */\r\n public async registerQuantityType(entry: CustomQuantityTypeDefinition, replace?: boolean) {\r\n if (!replace && this._quantityTypeRegistry.has(entry.key))\r\n return false;\r\n\r\n this._quantityTypeRegistry.set(entry.key, entry);\r\n // load any overrides so any saved overrides for the type being registered are applied\r\n if (this._unitFormattingSettingsProvider)\r\n await this._unitFormattingSettingsProvider.loadOverrides(undefined);\r\n\r\n if (entry.getDefaultFormatPropsBySystem) {\r\n const formatProps = entry.getDefaultFormatPropsBySystem(this.activeUnitSystem);\r\n await this.loadFormatAndParserSpec(entry, formatProps);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** Reinitialize caches. Typically called by active UnitFormattingSettingsProvider.\r\n * startDefaultTool - set to true to start the Default to instead of leaving any active tool pointing to cached unit data that is no longer valid\r\n * @public\r\n */\r\n public async reinitializeFormatAndParsingsMaps(overrideFormatPropsByUnitSystem: Map<UnitSystemKey, Map<QuantityTypeKey, FormatProps>>,\r\n unitSystemKey?: UnitSystemKey, fireUnitSystemChanged?: boolean, startDefaultTool?: boolean): Promise<void> {\r\n this._overrideFormatPropsByUnitSystem.clear();\r\n if (overrideFormatPropsByUnitSystem.size) {\r\n this._overrideFormatPropsByUnitSystem = overrideFormatPropsByUnitSystem;\r\n }\r\n\r\n unitSystemKey && (this._activeUnitSystem = unitSystemKey);\r\n await this.loadFormatAndParsingMapsForSystem(this._activeUnitSystem);\r\n fireUnitSystemChanged && this.onActiveFormattingUnitSystemChanged.emit({ system: this._activeUnitSystem });\r\n IModelApp.toolAdmin && startDefaultTool && await IModelApp.toolAdmin.startDefaultTool();\r\n }\r\n\r\n /** Set the Active unit system to one of the supported types. This will asynchronously load the formatter and parser specs for the activated system. */\r\n public async setActiveUnitSystem(isImperialOrUnitSystem: UnitSystemKey | boolean, restartActiveTool?: boolean): Promise<void> {\r\n let systemType: UnitSystemKey;\r\n if (typeof isImperialOrUnitSystem === \"boolean\")\r\n systemType = isImperialOrUnitSystem ? \"imperial\" : \"metric\";\r\n else\r\n systemType = isImperialOrUnitSystem;\r\n\r\n if (this._activeUnitSystem === systemType)\r\n return;\r\n\r\n this._activeUnitSystem = systemType;\r\n await this.loadFormatAndParsingMapsForSystem(systemType);\r\n // allow settings provider to store the change\r\n await this._unitFormattingSettingsProvider?.storeUnitSystemSetting({ system: systemType });\r\n // fire current event\r\n this.onActiveFormattingUnitSystemChanged.emit({ system: systemType });\r\n if (IModelApp.toolAdmin && restartActiveTool)\r\n return IModelApp.toolAdmin.startDefaultTool();\r\n }\r\n\r\n /** Retrieve the active [[UnitSystemKey]] which is used to determine what formats are to be used to display quantities */\r\n public get activeUnitSystem(): UnitSystemKey { return this._activeUnitSystem; }\r\n\r\n /** Clear any formatting override for specified quantity type, but only for the \"active\" Unit System. */\r\n public async clearOverrideFormats(type: QuantityTypeArg) {\r\n await this.clearOverrideFormatsByQuantityTypeKey(this.getQuantityTypeKey(type));\r\n }\r\n\r\n /** Set formatting override for specified quantity type, but only for the \"active\" Unit System. */\r\n public async setOverrideFormats(type: QuantityTypeArg, overrideEntry: OverrideFormatEntry) {\r\n await this.setOverrideFormatsByQuantityTypeKey(this.getQuantityTypeKey(type), overrideEntry);\r\n }\r\n\r\n /** Set Override Format for a quantity type, but only in the \"active\" Unit System. */\r\n public async setOverrideFormat(type: QuantityTypeArg, overrideFormat: FormatProps) {\r\n const typeKey = this.getQuantityTypeKey(type);\r\n let overrideEntry: OverrideFormatEntry = {};\r\n if (this.activeUnitSystem === \"imperial\")\r\n overrideEntry = { imperial: overrideFormat };\r\n else if (this.activeUnitSystem === \"metric\")\r\n overrideEntry = { metric: overrideFormat };\r\n else if (this.activeUnitSystem === \"usCustomary\")\r\n overrideEntry = { usCustomary: overrideFormat };\r\n else\r\n overrideEntry = { usSurvey: overrideFormat };\r\n\r\n await this.setOverrideFormatsByQuantityTypeKey(typeKey, overrideEntry);\r\n }\r\n\r\n /** Clear formatting override for all quantity types, but only for the \"active\" Unit System. */\r\n public async clearAllOverrideFormats() {\r\n if (0 === this._overrideFormatPropsByUnitSystem.size)\r\n return;\r\n\r\n if (this._overrideFormatPropsByUnitSystem.has(this.activeUnitSystem)) {\r\n const overrides = this._overrideFormatPropsByUnitSystem.get(this.activeUnitSystem);\r\n const typesRemoved: string[] = [];\r\n if (overrides && overrides.size) {\r\n const promises = new Array<Promise<void> | undefined>();\r\n overrides.forEach((_props, typeKey) => {\r\n typesRemoved.push(typeKey);\r\n promises.push(this._unitFormattingSettingsProvider?.storeFormatOverrides({ typeKey, unitSystem: this.activeUnitSystem }));\r\n });\r\n await Promise.all(promises);\r\n }\r\n\r\n if (typesRemoved.length) {\r\n const promises = new Array<Promise<void>>();\r\n typesRemoved.forEach((typeRemoved) => promises.push(this.loadDefaultFormatAndParserSpecForQuantity(typeRemoved)));\r\n await Promise.all(promises);\r\n // trigger a message to let callers know the format has changed.\r\n this.onQuantityFormatsChanged.emit({ quantityType: typesRemoved.join(\"|\") });\r\n }\r\n }\r\n }\r\n\r\n /** Converts a QuantityTypeArg into a QuantityTypeKey/string value that can be used to lookup custom and standard quantity types. */\r\n public getQuantityTypeKey(type: QuantityTypeArg): string {\r\n return getQuantityTypeKey(type);\r\n }\r\n\r\n /** Return [[QuantityTypeDefinition]] if type has been registered. Standard QuantityTypes are automatically registered. */\r\n public getQuantityDefinition(type: QuantityTypeArg) {\r\n return this.quantityTypesRegistry.get(this.getQuantityTypeKey(type));\r\n }\r\n\r\n /** Synchronous call to get a FormatterSpec of a QuantityType. If the FormatterSpec is not yet cached an undefined object is returned. The\r\n * cache is populated by the async call loadFormatAndParsingMapsForSystem.\r\n */\r\n public findFormatterSpecByQuantityType(type: QuantityTypeArg, _unused?: boolean): FormatterSpec | undefined {\r\n return this._activeFormatSpecsByType.get(this.getQuantityTypeKey(type));\r\n }\r\n\r\n /** Asynchronous Call to get a FormatterSpec for a QuantityType. This formatter spec can be used to synchronously format quantities. */\r\n public async generateFormatterSpecByType(type: QuantityTypeArg, formatProps: FormatProps) {\r\n const quantityTypeDefinition = this.quantityTypesRegistry.get(this.getQuantityTypeKey(type));\r\n if (quantityTypeDefinition)\r\n return quantityTypeDefinition.generateFormatterSpec(formatProps, this.unitsProvider);\r\n\r\n throw new Error(`Unable to generate FormatSpec for QuantityType ${type}`);\r\n }\r\n\r\n /** Asynchronous Call to get a FormatterSpec for a QuantityType and a Unit System. This formatter spec can be used to synchronously format quantities.\r\n * @param type One of the built-in quantity types supported.\r\n * @param system Requested unit system key. Note it is more efficient to use setActiveUnitSystem to set up formatters for all\r\n * quantity types of a unit system.\r\n * @return A FormatterSpec Promise.\r\n */\r\n public async getFormatterSpecByQuantityTypeAndSystem(type: QuantityTypeArg, system?: UnitSystemKey): Promise<FormatterSpec | undefined> {\r\n const quantityKey = this.getQuantityTypeKey(type);\r\n const requestedSystem = system ?? this.activeUnitSystem;\r\n\r\n if (requestedSystem === this.activeUnitSystem) {\r\n const formatterSpec = this._activeFormatSpecsByType.get(quantityKey);\r\n if (formatterSpec)\r\n return formatterSpec;\r\n }\r\n\r\n const entry = this.quantityTypesRegistry.get(quantityKey);\r\n if (!entry)\r\n throw new Error(`Unable to find registered quantity type with key ${quantityKey}`);\r\n return entry.generateFormatterSpec(this.getFormatPropsByQuantityTypeEntryAndSystem(entry, requestedSystem), this.unitsProvider);\r\n }\r\n\r\n /** Asynchronous Call to get a FormatterSpec for a QuantityType.\r\n * @param type One of the built-in quantity types supported.\r\n * @param isImperial Argument to specify use of imperial or metric unit system. If left undefined the active unit system is used.\r\n * @return A FormatterSpec Promise.\r\n */\r\n public async getFormatterSpecByQuantityType(type: QuantityTypeArg, isImperial?: boolean): Promise<FormatterSpec | undefined> {\r\n let requestedSystem = this.activeUnitSystem;\r\n if (undefined !== isImperial)\r\n requestedSystem = isImperial ? \"imperial\" : \"metric\";\r\n return this.getFormatterSpecByQuantityTypeAndSystem(type, requestedSystem);\r\n }\r\n\r\n /** Synchronous call to get a ParserSpec for a QuantityType. If the ParserSpec is not yet cached an undefined object is returned. The\r\n * cache is populated when the active units system is set.\r\n */\r\n public findParserSpecByQuantityType(type: QuantityTypeArg): ParserSpec | undefined {\r\n return this._activeParserSpecsByType.get(this.getQuantityTypeKey(type));\r\n }\r\n\r\n /** Asynchronous Call to get a ParserSpec for a QuantityType. If the UnitSystemKey is not specified the active Unit System is used. **/\r\n public async getParserSpecByQuantityTypeAndSystem(type: QuantityTypeArg, system?: UnitSystemKey): Promise<ParserSpec | undefined> {\r\n const quantityKey = this.getQuantityTypeKey(type);\r\n const requestedSystem = system ?? this.activeUnitSystem;\r\n\r\n if (requestedSystem === this.activeUnitSystem) {\r\n const parserSpec = this._activeParserSpecsByType.get(quantityKey);\r\n if (parserSpec)\r\n return parserSpec;\r\n }\r\n\r\n const entry = this.quantityTypesRegistry.get(quantityKey);\r\n if (!entry)\r\n throw new Error(`Unable to find registered quantity type with key ${quantityKey}`);\r\n return entry.generateParserSpec(this.getFormatPropsByQuantityTypeEntryAndSystem(entry, requestedSystem), this.unitsProvider);\r\n }\r\n\r\n /** Asynchronous Call to get a ParserSpec for a QuantityType.\r\n * @param type One of the built-in quantity types supported.\r\n * @param isImperial Argument to specify use of imperial or metric unit system. If left undefined the active unit system is used.\r\n * @return A FormatterSpec Promise.\r\n */\r\n public async getParserSpecByQuantityType(type: QuantityTypeArg, isImperial?: boolean): Promise<ParserSpec | undefined> {\r\n let requestedSystem = this.activeUnitSystem;\r\n if (undefined !== isImperial)\r\n requestedSystem = isImperial ? \"imperial\" : \"metric\";\r\n return this.getParserSpecByQuantityTypeAndSystem(type, requestedSystem);\r\n }\r\n\r\n /** Generates a formatted string asynchronously for a quantity given the provided properties.\r\n * @param props - an object containing value, valueUnitName, and kindOfQuantityName.\r\n * @return A promise resolving to a formatted string.\r\n */\r\n public formatQuantity(props: {\r\n value: number;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n }): Promise<string>;\r\n /** Generates a formatted string for a quantity given its format spec.\r\n * @param magnitude The magnitude of the quantity.\r\n * @param formatSpec The format specification. See methods getFormatterSpecByQuantityType and findFormatterSpecByQuantityType.\r\n * @return a formatted string.\r\n */\r\n public formatQuantity(magnitude: number, formatSpec?: FormatterSpec): string;\r\n\r\n public formatQuantity(args: number | object, spec?: FormatterSpec): string | Promise<string> {\r\n if (typeof args === \"number\") {\r\n /** Format a quantity value. Default FormatterSpec implementation uses Formatter.formatQuantity. */\r\n const magnitude = args;\r\n if (spec)\r\n return spec.applyFormatting(magnitude);\r\n return magnitude.toString();\r\n }\r\n\r\n return this.formatQuantityAsync(args as {\r\n value: number;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n });\r\n }\r\n\r\n private async formatQuantityAsync(args: {\r\n value: number;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n }): Promise<string> {\r\n const { value, valueUnitName, kindOfQuantityName } = args;\r\n const formatProps = await IModelApp.formatsProvider.getFormat(kindOfQuantityName);\r\n if (!formatProps) return value.toString();\r\n const formatSpec = await this.createFormatterSpec({\r\n persistenceUnitName: valueUnitName,\r\n formatProps,\r\n formatName: kindOfQuantityName,\r\n })\r\n return formatSpec.applyFormatting(value);\r\n }\r\n\r\n /** Parse input string asynchronously into a quantity given the provided properties.\r\n * @param props - an object containing value, valueUnitName, and kindOfQuantityName.\r\n * @return Promise resolving to a QuantityParseResult object containing either the parsed value or an error value if unsuccessful.\r\n */\r\n public parseToQuantityValue(props: {\r\n value: string;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n }): Promise<QuantityParseResult>;\r\n /** Parse input string into quantity given the ParserSpec\r\n * @param inString The magnitude of the quantity.\r\n * @param parserSpec The parse specification the defines the expected format of the string and the conversion to the output unit.\r\n * @return QuantityParseResult object containing either the parsed value or an error value if unsuccessful.\r\n */\r\n public parseToQuantityValue(inString: string, parserSpec?: ParserSpec): QuantityParseResult;\r\n\r\n public parseToQuantityValue(args: string | object, parserSpec?: ParserSpec): QuantityParseResult | Promise<QuantityParseResult> {\r\n if (typeof args === \"string\") {\r\n /** Parse a quantity value. Default ParserSpec implementation uses ParserSpec.parseToQuantityValue. */\r\n const inString = args;\r\n if (parserSpec)\r\n return parserSpec.parseToQuantityValue(inString);\r\n return { ok: false, error: ParseError.InvalidParserSpec };\r\n }\r\n return this.parseToQuantityValueAsync(args as {\r\n value: string;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n });\r\n }\r\n\r\n private async parseToQuantityValueAsync(args: {\r\n value: string;\r\n valueUnitName: string;\r\n kindOfQuantityName: string;\r\n }): Promise<QuantityParseResult> {\r\n const { value, valueUnitName, kindOfQuantityName } = args;\r\n const formatProps = await IModelApp.formatsProvider.getFormat(kindOfQuantityName);\r\n if (!formatProps) return { ok: false, error: ParseError.InvalidParserSpec };\r\n const parserSpec = await this.createParserSpec({\r\n persistenceUnitName: valueUnitName,\r\n formatProps,\r\n formatName: kindOfQuantityName,\r\n });\r\n return parserSpec.parseToQuantityValue(value);\r\n }\r\n\r\n /**\r\n * Get a UnitSystemKey from a string that may have been entered via a key-in. Supports different variation of\r\n * unit system names that have been used in the past.\r\n */\r\n public getUnitSystemFromString(inputSystem: string, fallback?: UnitSystemKey): UnitSystemKey {\r\n switch (inputSystem.toLowerCase()) {\r\n case \"metric\":\r\n case \"si\":\r\n return \"metric\";\r\n case \"imperial\":\r\n case \"british-imperial\":\r\n return \"imperial\";\r\n case \"uscustomary\":\r\n case \"us-customary\":\r\n case \"us\":\r\n return \"usCustomary\";\r\n case \"ussurvey\":\r\n case \"us-survey\":\r\n case \"survey\":\r\n return \"usSurvey\";\r\n default:\r\n if (undefined !== fallback)\r\n return fallback;\r\n break;\r\n }\r\n return \"imperial\";\r\n }\r\n\r\n /** Return true if the QuantityType is using an override format. */\r\n public hasActiveOverride(type: QuantityTypeArg, checkOnlyActiveUnitSystem?: boolean): boolean {\r\n const quantityTypeKey = this.getQuantityTypeKey(type);\r\n\r\n if (checkOnlyActiveUnitSystem) {\r\n const overrides = this._overrideFormatPropsByUnitSystem.get(this.activeUnitSystem);\r\n if (overrides && overrides.has(quantityTypeKey))\r\n return true;\r\n return false;\r\n }\r\n\r\n for (const [_key, overrideMap] of this._overrideFormatPropsByUnitSystem) {\r\n if (overrideMap.has(quantityTypeKey))\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** Get the cached FormatProps give a quantity type. If ignoreOverrides is false then if the format has been overridden\r\n * the overridden format is returned, else the standard format is returned.\r\n */\r\n public getFormatPropsByQuantityType(quantityType: QuantityTypeArg, requestedSystem?: UnitSystemKey, ignoreOverrides?: boolean) {\r\n const quantityEntry = this.quantityTypesRegistry.get(this.getQuantityTypeKey(quantityType));\r\n if (quantityEntry)\r\n return this.getFormatPropsByQuantityTypeEntryAndSystem(quantityEntry, requestedSystem ?? this.activeUnitSystem, ignoreOverrides);\r\n return undefined;\r\n }\r\n\r\n // keep following to maintain existing API of implementing UnitsProvider\r\n /** Find [UnitProp] for a specific unit label. */\r\n public async findUnit(unitLabel: string, schemaName?: string, phenomenon?: string, unitSystem?: string): Promise<UnitProps> {\r\n return this._unitsProvider.findUnit(unitLabel, schemaName, phenomenon, unitSystem);\r\n }\r\n\r\n /** Returns all defined units for the specified Unit Family/Phenomenon. */\r\n public async getUnitsByFamily(phenomenon: string): Promise<UnitProps[]> {\r\n return this._unitsProvider.getUnitsByFamily(phenomenon);\r\n }\r\n\r\n /** Find [UnitProp] for a specific unit name. */\r\n public async findUnitByName(unitName: string): Promise<UnitProps> {\r\n return this._unitsProvider.findUnitByName(unitName);\r\n }\r\n\r\n /** Returns data needed to convert from one Unit to another in the same Unit Family/Phenomenon. */\r\n public async getConversion(fromUnit: UnitProps, toUnit: UnitProps): Promise<UnitConversionProps> {\r\n return this._unitsProvider.getConversion(fromUnit, toUnit);\r\n }\r\n\r\n /**\r\n * Creates a [[FormatterSpec]] for a given persistence unit name and format properties, using the [[UnitsProvider]] to resolve the persistence unit.\r\n * @beta\r\n * @param props - A [[CreateFormattingSpecProps]] interface.\r\n */\r\n public async createFormatterSpec(props: CreateFormattingSpecProps): Promise<FormatterSpec> {\r\n const { persistenceUnitName, formatProps, formatName } = props;\r\n const persistenceUnitProps = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(formatName ?? \"temp\", this._unitsProvider, formatProps);\r\n return FormatterSpec.create(`${format.name}_format_spec`, format, this._unitsProvider, persistenceUnitProps);\r\n }\r\n\r\n /**\r\n * Creates a [[ParserSpec]] for a given persistence unit name and format properties, using the [[UnitsProvider]] to resolve the persistence unit.\r\n * @beta\r\n * @param props - A [[CreateFormattingSpecProps]] object.\r\n */\r\n public async createParserSpec(props: CreateFormattingSpecProps): Promise<ParserSpec> {\r\n const { persistenceUnitName, formatProps, formatName } = props;\r\n const persistenceUnitProps = await this._unitsProvider.findUnitByName(persistenceUnitName);\r\n const format = await Format.createFromJSON(formatName ?? \"temp\", this._unitsProvider, formatProps);\r\n return ParserSpec.create(format, this._unitsProvider, persistenceUnitProps);\r\n }\r\n\r\n /**\r\n * @beta\r\n * Returns a [[FormattingSpecEntry]] for a given name, typically a KindOfQuantity full name.\r\n */\r\n public getSpecsByName(name: string): FormattingSpecEntry | undefined {\r\n return this._formatSpecsRegistry.get(name);\r\n }\r\n\r\n /**\r\n * Populates the registry with a new FormatterSpec and ParserSpec entry for the given format name.\r\n * @beta\r\n * @param name The key used to identify the formatter and parser spec\r\n * @param persistenceUnitName The name of the persistence unit\r\n * @param formatProps If not supplied, tries to retrieve the [[FormatProps]] from [[IModelApp.formatsProvider]]\r\n */\r\n public async addFormattingSpecsToRegistry(name: string, persistenceUnitName: string, formatProps?: FormatProps): Promise<void> {\r\n if (!formatProps) {\r\n formatProps = await IModelApp.formatsProvider.getFormat(name);\r\n }\r\n if (formatProps) {\r\n const formatterSpec = await this.createFormatterSpec({\r\n persistenceUnitName,\r\n formatProps,\r\n formatName: name,\r\n });\r\n const parserSpec = await this.createParserSpec({\r\n persistenceUnitName,\r\n formatProps,\r\n formatName: name,\r\n });\r\n this._formatSpecsRegistry.set(name, { formatterSpec, parserSpec });\r\n } else {\r\n throw new Error(`Unable to find format properties for ${name} with persistence unit ${persistenceUnitName}`);\r\n }\r\n }\r\n}\r\n\r\n// ========================================================================================================================================\r\n// Default Data\r\n// ========================================================================================================================================\r\nconst DEFAULT_FORMATKEY_BY_UNIT_SYSTEM = [\r\n {\r\n system: \"metric\", // PresentationUnitSystem.Metric,\r\n entries: [\r\n { type: getQuantityTypeKey(QuantityType.Length), formatKey: \"[units:length]meter4\" },\r\n { type: getQuantityTypeKey(QuantityType.Angle), formatKey: \"[units:angle]degree2\" },\r\n { type: getQuantityTypeKey(QuantityType.Area), formatKey: \"[units:area]mSquared4\" },\r\n { type: getQuantityTypeKey(QuantityType.Volume), formatKey: \"[units:volume]mCubed4\" },\r\n { type: getQuantityTypeKey(QuantityType.LatLong), formatKey: \"[units:angle]dms\" },\r\n { type: getQuantityTypeKey(QuantityType.Coordinate), formatKey: \"[units:length]meter2\" },\r\n { type: getQuantityTypeKey(QuantityType.Stationing), formatKey: \"[units:length]m-sta2\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthSurvey), formatKey: \"[units:length]meter4\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: \"[units:length]meter4\" },\r\n ],\r\n },\r\n {\r\n system: \"imperial\", // PresentationUnitSystem.BritishImperial,\r\n entries: [\r\n { type: getQuantityTypeKey(QuantityType.Length), formatKey: \"[units:length]fi8\" },\r\n { type: getQuantityTypeKey(QuantityType.Angle), formatKey: \"[units:angle]dms2\" },\r\n { type: getQuantityTypeKey(QuantityType.Area), formatKey: \"[units:area]fSquared4\" },\r\n { type: getQuantityTypeKey(QuantityType.Volume), formatKey: \"[units:volume]fCubed4\" },\r\n { type: getQuantityTypeKey(QuantityType.LatLong), formatKey: \"[units:angle]dms\" },\r\n { type: getQuantityTypeKey(QuantityType.Coordinate), formatKey: \"[units:length]feet2\" },\r\n { type: getQuantityTypeKey(QuantityType.Stationing), formatKey: \"[units:length]f-sta2\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthSurvey), formatKey: \"[units:length]f-survey-4-labeled\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: \"[units:length]feet4\" },\r\n ],\r\n },\r\n {\r\n system: \"usCustomary\", // PresentationUnitSystem.UsCustomary\r\n entries: [\r\n { type: getQuantityTypeKey(QuantityType.Length), formatKey: \"[units:length]fi8\" },\r\n { type: getQuantityTypeKey(QuantityType.Angle), formatKey: \"[units:angle]dms2\" },\r\n { type: getQuantityTypeKey(QuantityType.Area), formatKey: \"[units:area]fSquared4\" },\r\n { type: getQuantityTypeKey(QuantityType.Volume), formatKey: \"[units:volume]fCubed4\" },\r\n { type: getQuantityTypeKey(QuantityType.LatLong), formatKey: \"[units:angle]dms\" },\r\n { type: getQuantityTypeKey(QuantityType.Coordinate), formatKey: \"[units:length]feet2\" },\r\n { type: getQuantityTypeKey(QuantityType.Stationing), formatKey: \"[units:length]f-sta2\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthSurvey), formatKey: \"[units:length]f-survey-4\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: \"[units:length]feet4\" },\r\n ],\r\n },\r\n {\r\n system: \"usSurvey\", // PresentationUnitSystem.UsSurvey\r\n entries: [\r\n { type: getQuantityTypeKey(QuantityType.Length), formatKey: \"[units:length]f-survey-4\" },\r\n { type: getQuantityTypeKey(QuantityType.Angle), formatKey: \"[units:angle]dms2\" },\r\n { type: getQuantityTypeKey(QuantityType.Area), formatKey: \"[units:area]usSurveyFtSquared4\" },\r\n { type: getQuantityTypeKey(QuantityType.Volume), formatKey: \"[units:volume]usSurveyFtCubed4\" },\r\n { type: getQuantityTypeKey(QuantityType.LatLong), formatKey: \"[units:angle]dms\" },\r\n { type: getQuantityTypeKey(QuantityType.Coordinate), formatKey: \"[units:length]f-survey-2\" },\r\n { type: getQuantityTypeKey(QuantityType.Stationing), formatKey: \"[units:length]f-survey-sta2\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthSurvey), formatKey: \"[units:length]f-survey-4\" },\r\n { type: getQuantityTypeKey(QuantityType.LengthEngineering), formatKey: \"[units:length]f-survey-4\" },\r\n ],\r\n },\r\n];\r\n\r\n/** Interface used to define structure of default format definitions. */\r\ninterface UniqueFormatsProps {\r\n readonly key: string;\r\n readonly description?: string;\r\n readonly format: FormatProps;\r\n}\r\n\r\n/** List of default format definitions used by the Standard QuantityTypes. */\r\nconst DEFAULT_FORMATPROPS: UniqueFormatsProps[] = [\r\n {\r\n key: \"[units:length]meter4\",\r\n description: \"meters (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m\", name: \"Units.M\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]meter2\",\r\n description: \"meters (labeled) 2 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m\", name: \"Units.M\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n },\r\n },\r\n\r\n {\r\n key: \"[units:length]feet4\",\r\n description: \"feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]feet2\",\r\n description: \"feet (labeled) 2 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]fi8\",\r\n description: \"feet-inch 1/8 (labeled)\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"-\",\r\n units: [{ label: \"'\", name: \"Units.FT\" }, { label: \"\\\"\", name: \"Units.IN\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 8,\r\n type: \"Fractional\",\r\n uomSeparator: \"\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]f-sta2\",\r\n description: \"stationing feet-2 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.FT\" }],\r\n },\r\n formatTraits: [\"trailZeroes\", \"keepSingleZero\"],\r\n stationOffsetSize: 2,\r\n precision: 2,\r\n type: \"Station\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]f-survey-sta2\",\r\n description: \"stationing feet-2 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"trailZeroes\", \"keepSingleZero\"],\r\n stationOffsetSize: 2,\r\n precision: 2,\r\n type: \"Station\",\r\n },\r\n },\r\n\r\n {\r\n key: \"[units:length]m-sta2\",\r\n description: \"stationing meters-2 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m\", name: \"Units.M\" }],\r\n },\r\n formatTraits: [\"trailZeroes\", \"keepSingleZero\"],\r\n stationOffsetSize: 3,\r\n precision: 2,\r\n type: \"Station\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]f-survey-2\",\r\n description: \"survey feet (labeled)-2 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:length]f-survey-4-labeled\",\r\n description: \"survey feet (labeled)-4 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft (US Survey)\", name: \"Units.US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n\r\n {\r\n key: \"[units:length]f-survey-4\",\r\n description: \"survey feet (labeled)-4 decimal places \",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft\", name: \"Units.US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:angle]degree2\",\r\n description: \"degrees (labeled) 2 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"°\", name: \"Units.ARC_DEG\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n uomSeparator: \"\",\r\n },\r\n },\r\n {\r\n key: \"[units:angle]dms\",\r\n description: \"degrees minutes seconds (labeled) 0 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"°\", name: \"Units.ARC_DEG\" }, { label: \"'\", name: \"Units.ARC_MINUTE\" }, { label: \"\\\"\", name: \"Units.ARC_SECOND\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n uomSeparator: \"\",\r\n },\r\n },\r\n {\r\n key: \"[units:angle]dms2\",\r\n description: \"degrees minutes seconds (labeled) 2 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"°\", name: \"Units.ARC_DEG\" }, { label: \"'\", name: \"Units.ARC_MINUTE\" }, { label: \"\\\"\", name: \"Units.ARC_SECOND\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 2,\r\n type: \"Decimal\",\r\n uomSeparator: \"\",\r\n },\r\n },\r\n {\r\n key: \"[units:area]mSquared4\",\r\n description: \"square meters (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m²\", name: \"Units.SQ_M\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:area]fSquared4\",\r\n description: \"square feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft²\", name: \"Units.SQ_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:area]usSurveyFtSquared4\",\r\n description: \"square survey feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft²\", name: \"Units.SQ_US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:volume]mCubed4\",\r\n description: \"cubic meters (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"m³\", name: \"Units.CUB_M\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:volume]fCubed4\",\r\n description: \"cubic feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft³\", name: \"Units.CUB_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n {\r\n key: \"[units:volume]usSurveyFtCubed4\",\r\n description: \"cubic survey feet (labeled) 4 decimal places\",\r\n format: {\r\n composite: {\r\n includeZero: true,\r\n spacer: \"\",\r\n units: [{ label: \"ft³\", name: \"Units.CUB_US_SURVEY_FT\" }],\r\n },\r\n formatTraits: [\"keepSingleZero\", \"showUnitLabel\"],\r\n precision: 4,\r\n type: \"Decimal\",\r\n },\r\n },\r\n];\r\n"]}
@@ -23,7 +23,7 @@ class EventController {
23
23
  const element = vp.parentDiv;
24
24
  if (element === undefined)
25
25
  return;
26
- // Put events on the parentDiv to allows us to stopPropagation of events to the view canvas when they are meant for a sibling of view canvas (markup canvas, for example).
26
+ // Put events on the parentDiv to allow us to stopPropagation of events to the view canvas when they are meant for a sibling of view canvas (markup canvas, for example).
27
27
  this.addDomListeners(["mousedown", "mouseup", "mousemove", "mouseover", "mouseout", "wheel", "touchstart", "touchend", "touchcancel", "touchmove"], element);
28
28
  element.oncontextmenu = element.onselectstart = () => false;
29
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EventController.js","sourceRoot":"","sources":["../../../src/tools/EventController.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,2CAAwC;AAExC;;;;;GAKG;AACH,MAAa,eAAe;IAGP;IAFF,SAAS,GAAmB,EAAE,CAAC;IAEhD,YAAmB,EAAkB;QAAlB,OAAE,GAAF,EAAE,CAAgB;QACnC,MAAM,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;QAC7B,IAAI,OAAO,KAAK,SAAS;YACvB,OAAO;QAET,2KAA2K;QAC3K,IAAI,CAAC,eAAe,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;QAE7J,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC;IAC9D,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACK,eAAe,CAAC,OAAiB,EAAE,OAAoB;QAC7D,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,MAAM,QAAQ,GAAG,CAAC,EAAS,EAAE,EAAE;YAC7B,EAAE,CAAC,cAAc,EAAE,CAAC;YACpB,qBAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC7B,CAAC,CAAC;QACF,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApCD,0CAoCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tools\r\n */\r\n\r\nimport { ScreenViewport } from \"../Viewport\";\r\nimport { ToolAdmin } from \"./ToolAdmin\";\r\n\r\n/**\r\n * An EventController maps user input events from a Viewport to the ToolAdmin so that tools can process them.\r\n * Viewports are assigned an EventController when they are registered with ViewManager.addViewport and they are destroyed with ViewManager.dropViewport.\r\n * @public\r\n * @extensions\r\n */\r\nexport class EventController {\r\n private readonly _removals: VoidFunction[] = [];\r\n\r\n constructor(public vp: ScreenViewport) {\r\n const element = vp.parentDiv;\r\n if (element === undefined)\r\n return;\r\n\r\n // Put events on the parentDiv to allows us to stopPropagation of events to the view canvas when they are meant for a sibling of view canvas (markup canvas, for example).\r\n this.addDomListeners([\"mousedown\", \"mouseup\", \"mousemove\", \"mouseover\", \"mouseout\", \"wheel\", \"touchstart\", \"touchend\", \"touchcancel\", \"touchmove\"], element);\r\n\r\n element.oncontextmenu = element.onselectstart = () => false;\r\n }\r\n\r\n public destroy() {\r\n this._removals.forEach((remove) => remove());\r\n this._removals.length = 0;\r\n }\r\n\r\n /**\r\n * Call element.addEventListener for each type of DOM event supplied. Creates a listener that will forward the HTML event to ToolAdmin.addEvent.\r\n * Records the listener in the [[removals]] member so they are removed when this EventController is destroyed.\r\n * @param domType An array of DOM event types to pass to element.addEventListener\r\n * @param element The HTML element to which the listeners are added\r\n */\r\n private addDomListeners(domType: string[], element: HTMLElement) {\r\n const vp = this.vp;\r\n const listener = (ev: Event) => {\r\n ev.preventDefault();\r\n ToolAdmin.addEvent(ev, vp);\r\n };\r\n domType.forEach((type) => {\r\n element.addEventListener(type, listener, false);\r\n this._removals.push(() => element.removeEventListener(type, listener, false));\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"EventController.js","sourceRoot":"","sources":["../../../src/tools/EventController.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,2CAAwC;AAExC;;;;;GAKG;AACH,MAAa,eAAe;IAGP;IAFF,SAAS,GAAmB,EAAE,CAAC;IAEhD,YAAmB,EAAkB;QAAlB,OAAE,GAAF,EAAE,CAAgB;QACnC,MAAM,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;QAC7B,IAAI,OAAO,KAAK,SAAS;YACvB,OAAO;QAET,yKAAyK;QACzK,IAAI,CAAC,eAAe,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;QAE7J,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC;IAC9D,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACK,eAAe,CAAC,OAAiB,EAAE,OAAoB;QAC7D,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,MAAM,QAAQ,GAAG,CAAC,EAAS,EAAE,EAAE;YAC7B,EAAE,CAAC,cAAc,EAAE,CAAC;YACpB,qBAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC7B,CAAC,CAAC;QACF,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApCD,0CAoCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tools\r\n */\r\n\r\nimport { ScreenViewport } from \"../Viewport\";\r\nimport { ToolAdmin } from \"./ToolAdmin\";\r\n\r\n/**\r\n * An EventController maps user input events from a Viewport to the ToolAdmin so that tools can process them.\r\n * Viewports are assigned an EventController when they are registered with ViewManager.addViewport and they are destroyed with ViewManager.dropViewport.\r\n * @public\r\n * @extensions\r\n */\r\nexport class EventController {\r\n private readonly _removals: VoidFunction[] = [];\r\n\r\n constructor(public vp: ScreenViewport) {\r\n const element = vp.parentDiv;\r\n if (element === undefined)\r\n return;\r\n\r\n // Put events on the parentDiv to allow us to stopPropagation of events to the view canvas when they are meant for a sibling of view canvas (markup canvas, for example).\r\n this.addDomListeners([\"mousedown\", \"mouseup\", \"mousemove\", \"mouseover\", \"mouseout\", \"wheel\", \"touchstart\", \"touchend\", \"touchcancel\", \"touchmove\"], element);\r\n\r\n element.oncontextmenu = element.onselectstart = () => false;\r\n }\r\n\r\n public destroy() {\r\n this._removals.forEach((remove) => remove());\r\n this._removals.length = 0;\r\n }\r\n\r\n /**\r\n * Call element.addEventListener for each type of DOM event supplied. Creates a listener that will forward the HTML event to ToolAdmin.addEvent.\r\n * Records the listener in the [[removals]] member so they are removed when this EventController is destroyed.\r\n * @param domType An array of DOM event types to pass to element.addEventListener\r\n * @param element The HTML element to which the listeners are added\r\n */\r\n private addDomListeners(domType: string[], element: HTMLElement) {\r\n const vp = this.vp;\r\n const listener = (ev: Event) => {\r\n ev.preventDefault();\r\n ToolAdmin.addEvent(ev, vp);\r\n };\r\n domType.forEach((type) => {\r\n element.addEventListener(type, listener, false);\r\n this._removals.push(() => element.removeEventListener(type, listener, false));\r\n });\r\n }\r\n}\r\n"]}