@itwin/core-quantity 5.1.0-dev.69 → 5.1.0-dev.70
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.
- package/lib/cjs/Formatter/Format.d.ts +6 -0
- package/lib/cjs/Formatter/Format.d.ts.map +1 -1
- package/lib/cjs/Formatter/Format.js +22 -4
- package/lib/cjs/Formatter/Format.js.map +1 -1
- package/lib/cjs/Formatter/Formatter.d.ts.map +1 -1
- package/lib/cjs/Formatter/Formatter.js +4 -2
- package/lib/cjs/Formatter/Formatter.js.map +1 -1
- package/lib/cjs/Formatter/Interfaces.d.ts +2 -0
- package/lib/cjs/Formatter/Interfaces.d.ts.map +1 -1
- package/lib/cjs/Formatter/Interfaces.js.map +1 -1
- package/lib/esm/Formatter/Format.d.ts +6 -0
- package/lib/esm/Formatter/Format.d.ts.map +1 -1
- package/lib/esm/Formatter/Format.js +22 -4
- package/lib/esm/Formatter/Format.js.map +1 -1
- package/lib/esm/Formatter/Formatter.d.ts.map +1 -1
- package/lib/esm/Formatter/Formatter.js +4 -2
- package/lib/esm/Formatter/Formatter.js.map +1 -1
- package/lib/esm/Formatter/Interfaces.d.ts +2 -0
- package/lib/esm/Formatter/Interfaces.d.ts.map +1 -1
- package/lib/esm/Formatter/Interfaces.js.map +1 -1
- package/package.json +4 -4
|
@@ -23,6 +23,7 @@ export declare class BaseFormat {
|
|
|
23
23
|
protected _minWidth?: number;
|
|
24
24
|
protected _scientificType?: ScientificType;
|
|
25
25
|
protected _stationOffsetSize?: number;
|
|
26
|
+
protected _stationBaseFactor?: number;
|
|
26
27
|
protected _ratioType?: RatioType;
|
|
27
28
|
protected _azimuthBase?: number;
|
|
28
29
|
protected _azimuthBaseUnit?: UnitProps;
|
|
@@ -55,6 +56,11 @@ export declare class BaseFormat {
|
|
|
55
56
|
set stationSeparator(stationSeparator: string);
|
|
56
57
|
get stationOffsetSize(): number | undefined;
|
|
57
58
|
set stationOffsetSize(stationOffsetSize: number | undefined);
|
|
59
|
+
/** Gets the station base factor used for station formatting. This is a positive integer that acts as a multiplier
|
|
60
|
+
* for the base offset calculation. The default value is 1.
|
|
61
|
+
*/
|
|
62
|
+
get stationBaseFactor(): number | undefined;
|
|
63
|
+
set stationBaseFactor(stationBaseFactor: number | undefined);
|
|
58
64
|
get allowMathematicOperations(): boolean;
|
|
59
65
|
set allowMathematicOperations(allowMathematicOperations: boolean);
|
|
60
66
|
get formatTraits(): FormatTraits;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Format.d.ts","sourceRoot":"","sources":["../../../src/Formatter/Format.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EACL,gBAAgB,EAAE,YAAY,EAAuB,UAAU,EAAE,mBAAmB,EAEpF,SAAS,EAAE,cAAc,EACzB,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAqB,WAAW,EAAuB,MAAM,cAAc,CAAC;AAKjG;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,KAAK,CAAM;IACnB,SAAS,CAAC,YAAY,EAAE,MAAM,CAAO;IACrC,SAAS,CAAC,KAAK,EAAE,UAAU,CAAsB;IACjD,SAAS,CAAC,UAAU,EAAE,MAAM,CAAwB;IACpD,SAAS,CAAC,eAAe,EAAE,cAAc,CAA+B;IACxE,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAoD;IACvF,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAqD;IACzF,SAAS,CAAC,aAAa,SAAO;IAC9B,SAAS,CAAC,iBAAiB,SAAO;IAClC,SAAS,CAAC,aAAa,EAAE,YAAY,CAA8B;IACnE,SAAS,CAAC,OAAO,EAAE,MAAM,CAAO;IAChC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAQ;IACvC,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC7B,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I,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW;IAMvG;;OAEG;IACI,MAAM,IAAI,WAAW;CAkD7B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module Quantity
|
|
8
8
|
*/
|
|
@@ -33,6 +33,7 @@ class BaseFormat {
|
|
|
33
33
|
_minWidth; // optional; positive int
|
|
34
34
|
_scientificType; // required if type is scientific; options: normalized, zeroNormalized
|
|
35
35
|
_stationOffsetSize; // required when type is station; positive integer > 0
|
|
36
|
+
_stationBaseFactor; // optional positive integer base factor for station formatting; default is 1
|
|
36
37
|
_ratioType; // required if type is ratio; options: oneToN, NToOne, ValueBased, useGreatestCommonDivisor
|
|
37
38
|
_azimuthBase; // value always clockwise from north
|
|
38
39
|
_azimuthBaseUnit; // unit for azimuthBase value
|
|
@@ -67,6 +68,15 @@ class BaseFormat {
|
|
|
67
68
|
set stationSeparator(stationSeparator) { this._stationSeparator = stationSeparator; }
|
|
68
69
|
get stationOffsetSize() { return this._stationOffsetSize; }
|
|
69
70
|
set stationOffsetSize(stationOffsetSize) { stationOffsetSize = this._stationOffsetSize = stationOffsetSize; }
|
|
71
|
+
/** Gets the station base factor used for station formatting. This is a positive integer that acts as a multiplier
|
|
72
|
+
* for the base offset calculation. The default value is 1.
|
|
73
|
+
*/
|
|
74
|
+
get stationBaseFactor() {
|
|
75
|
+
return this._stationBaseFactor;
|
|
76
|
+
}
|
|
77
|
+
set stationBaseFactor(stationBaseFactor) {
|
|
78
|
+
this._stationBaseFactor = stationBaseFactor;
|
|
79
|
+
}
|
|
70
80
|
get allowMathematicOperations() { return this._allowMathematicOperations; }
|
|
71
81
|
set allowMathematicOperations(allowMathematicOperations) { this._allowMathematicOperations = allowMathematicOperations; }
|
|
72
82
|
get formatTraits() { return this._formatTraits; }
|
|
@@ -129,9 +139,15 @@ class BaseFormat {
|
|
|
129
139
|
if (FormatEnums_1.FormatType.Station === this.type) {
|
|
130
140
|
if (undefined === formatProps.stationOffsetSize)
|
|
131
141
|
throw new Exception_1.QuantityError(Exception_1.QuantityStatus.InvalidJson, `The Format ${this.name} is 'Station' type therefore the attribute 'stationOffsetSize' is required.`);
|
|
132
|
-
if (!Number.isInteger(formatProps.stationOffsetSize) || formatProps.stationOffsetSize
|
|
142
|
+
if (!Number.isInteger(formatProps.stationOffsetSize) || formatProps.stationOffsetSize <= 0) // must be a positive int > 0
|
|
133
143
|
throw new Exception_1.QuantityError(Exception_1.QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationOffsetSize' attribute. It should be a positive integer.`);
|
|
134
144
|
this._stationOffsetSize = formatProps.stationOffsetSize;
|
|
145
|
+
if (undefined !== formatProps.stationBaseFactor) {
|
|
146
|
+
// optional - must be a positive integer
|
|
147
|
+
if (!Number.isInteger(formatProps.stationBaseFactor) || formatProps.stationBaseFactor <= 0)
|
|
148
|
+
throw new Exception_1.QuantityError(Exception_1.QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationBaseFactor' attribute. It should be a positive integer.`);
|
|
149
|
+
this._stationBaseFactor = formatProps.stationBaseFactor;
|
|
150
|
+
}
|
|
135
151
|
}
|
|
136
152
|
if (undefined !== formatProps.showSignOption) { // optional; default is "onlyNegative"
|
|
137
153
|
this._showSignOption = (0, FormatEnums_1.parseShowSignOption)(formatProps.showSignOption, this.name);
|
|
@@ -238,6 +254,7 @@ class Format extends BaseFormat {
|
|
|
238
254
|
newFormat._uomSeparator = this._uomSeparator;
|
|
239
255
|
newFormat._stationSeparator = this._stationSeparator;
|
|
240
256
|
newFormat._stationOffsetSize = this._stationOffsetSize;
|
|
257
|
+
newFormat._stationBaseFactor = this._stationBaseFactor;
|
|
241
258
|
newFormat._formatTraits = this._formatTraits;
|
|
242
259
|
newFormat._spacer = this._spacer;
|
|
243
260
|
newFormat._includeZero = this._includeZero;
|
|
@@ -381,6 +398,7 @@ class Format extends BaseFormat {
|
|
|
381
398
|
ratioType: this.ratioType,
|
|
382
399
|
stationOffsetSize: this.stationOffsetSize,
|
|
383
400
|
stationSeparator: this.stationSeparator,
|
|
401
|
+
stationBaseFactor: this.stationBaseFactor,
|
|
384
402
|
azimuthBase: this.azimuthBase,
|
|
385
403
|
azimuthBaseUnit,
|
|
386
404
|
azimuthCounterClockwise: this.azimuthCounterClockwise,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Format.js","sourceRoot":"","sources":["../../../src/Formatter/Format.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,4CAAiD;AACjD,4CAA6D;AAE7D,+CAKuB;AACvB,6CAAiG;AAEjG,sFAAsF;AACtF,6JAA6J;AAE7J;;GAEG;AACH,MAAa,UAAU;IACb,KAAK,GAAG,EAAE,CAAC;IACT,YAAY,GAAW,GAAG,CAAC;IAC3B,KAAK,GAAe,wBAAU,CAAC,OAAO,CAAC,CAAC,iEAAiE;IACzG,UAAU,GAAW,8BAAgB,CAAC,GAAG,CAAC,CAAC,WAAW;IACtD,eAAe,GAAmB,4BAAc,CAAC,YAAY,CAAC,CAAC,iEAAiE;IAChI,iBAAiB,GAAW,6BAAiB,CAAC,8BAA8B,CAAC;IAC7E,kBAAkB,GAAW,6BAAiB,CAAC,+BAA+B,CAAC;IAC/E,aAAa,GAAG,GAAG,CAAC,CAAC,6EAA6E;IAClG,iBAAiB,GAAG,GAAG,CAAC,CAAC,2BAA2B;IACpD,aAAa,GAAiB,0B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AI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACrF,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QAElF,MAAM,eAAe,GAAgB;YACnC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,YAAY,EAAE,IAAA,iCAAmB,EAAC,IAAI,CAAC,YAAY,CAAC;YACpD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;YACrE,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe;YACf,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,cAAc;YACd,SAAS;SACV,CAAC;QAEF,IAAI,IAAI,CAAC,WAAW;YAClB,OAAO;gBACL,GAAG,eAAe;gBAClB,MAAM,EAAE,IAAI,CAAC,WAAW;aACJ,CAAC;QAEzB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAvOD,wBAuOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Quantity\n */\n\nimport { QuantityConstants } from \"../Constants\";\nimport { QuantityError, QuantityStatus } from \"../Exception\";\nimport { UnitProps, UnitsProvider } from \"../Interfaces\";\nimport {\n DecimalPrecision, FormatTraits, formatTraitsToArray, FormatType, FractionalPrecision,\n getTraitString, parseFormatTrait, parseFormatType, parsePrecision, parseRatioType, parseScientificType, parseShowSignOption,\n RatioType, ScientificType,\n ShowSignOption,\n} from \"./FormatEnums\";\nimport { CloneOptions, CustomFormatProps, FormatProps, isCustomFormatProps } from \"./Interfaces\";\n\n// cSpell:ignore ZERONORMALIZED, nosign, onlynegative, signalways, negativeparentheses\n// cSpell:ignore trailzeroes, keepsinglezero, zeroempty, keepdecimalpoint, applyrounding, fractiondash, showunitlabel, prependunitlabel, exponentonlynegative\n\n/** A base Format class with shared properties and functionality between quantity and ecschema-metadata Format classes\n * @beta\n */\nexport class BaseFormat {\n private _name = \"\";\n protected _roundFactor: number = 0.0;\n protected _type: FormatType = FormatType.Decimal; // required; options are decimal, fractional, scientific, station\n protected _precision: number = DecimalPrecision.Six; // required\n protected _showSignOption: ShowSignOption = ShowSignOption.OnlyNegative; // options: noSign, onlyNegative, signAlways, negativeParentheses\n protected _decimalSeparator: string = QuantityConstants.LocaleSpecificDecimalSeparator;\n protected _thousandSeparator: string = QuantityConstants.LocaleSpecificThousandSeparator;\n protected _uomSeparator = \" \"; // optional; default is \" \"; defined separator between magnitude and the unit\n protected _stationSeparator = \"+\"; // optional; default is \"+\"\n protected _formatTraits: FormatTraits = FormatTraits.Uninitialized;\n protected _spacer: string = \" \"; // optional; default is \" \"\n protected _includeZero: boolean = true; // optional; default is true\n protected _minWidth?: number; // optional; positive int\n protected _scientificType?: ScientificType; // required if type is scientific; options: normalized, zeroNormalized\n protected _stationOffsetSize?: number; // required when type is station; positive integer > 0\n protected _ratioType?: RatioType; // required if type is ratio; options: oneToN, NToOne, ValueBased, useGreatestCommonDivisor\n protected _azimuthBase?: number; // value always clockwise from north\n protected _azimuthBaseUnit?: UnitProps; // unit for azimuthBase value\n protected _azimuthCounterClockwise?: boolean; // if set to true, azimuth values are returned counter-clockwise from base\n protected _revolutionUnit?: UnitProps; // unit that represents a revolution, required for bearing or azimuth types\n protected _allowMathematicOperations: boolean = false; // optional; enables calculating mathematic operations like addition and subtraction; default is false.\n\n constructor(name: string) {\n this._name = name;\n }\n\n public get name(): string { return this._name; }\n\n public get roundFactor(): number { return this._roundFactor; }\n public set roundFactor(roundFactor: number) { this._roundFactor = roundFactor; }\n\n public get type(): FormatType { return this._type; }\n public set type(formatType: FormatType) { this._type = formatType; }\n\n public get precision(): DecimalPrecision | FractionalPrecision { return this._precision; }\n public set precision(precision: DecimalPrecision | FractionalPrecision) { this._precision = precision; }\n\n public get minWidth(): number | undefined { return this._minWidth; }\n public set minWidth(minWidth: number | undefined) { this._minWidth = minWidth; }\n\n public get scientificType(): ScientificType | undefined { return this._scientificType; }\n public set scientificType(scientificType: ScientificType | undefined) { this._scientificType = scientificType; }\n\n public get ratioType(): RatioType | undefined { return this._ratioType; }\n public set ratioType(ratioType: RatioType | undefined) { this._ratioType = ratioType; }\n\n public get showSignOption(): ShowSignOption { return this._showSignOption; }\n public set showSignOption(showSignOption: ShowSignOption) { this._showSignOption = showSignOption; }\n\n public get decimalSeparator(): string { return this._decimalSeparator; }\n public set decimalSeparator(decimalSeparator: string) { this._decimalSeparator = decimalSeparator; }\n\n public get thousandSeparator(): string { return this._thousandSeparator; }\n public set thousandSeparator(thousandSeparator: string) { this._thousandSeparator = thousandSeparator; }\n\n public get uomSeparator(): string { return this._uomSeparator; }\n public set uomSeparator(uomSeparator: string) { this._uomSeparator = uomSeparator; }\n\n public get stationSeparator(): string { return this._stationSeparator; }\n public set stationSeparator(stationSeparator: string) { this._stationSeparator = stationSeparator; }\n\n public get stationOffsetSize(): number | undefined { return this._stationOffsetSize; }\n public set stationOffsetSize(stationOffsetSize: number | undefined) { stationOffsetSize = this._stationOffsetSize = stationOffsetSize; }\n\n public get allowMathematicOperations(): boolean { return this._allowMathematicOperations; }\n public set allowMathematicOperations(allowMathematicOperations: boolean) { this._allowMathematicOperations = allowMathematicOperations; }\n\n public get formatTraits(): FormatTraits { return this._formatTraits; }\n public set formatTraits(formatTraits: FormatTraits) { this._formatTraits = formatTraits; }\n\n public get spacer(): string | undefined { return this._spacer; }\n public set spacer(spacer: string | undefined) { this._spacer = spacer ?? this._spacer; }\n public get spacerOrDefault(): string { return this._spacer ?? \" \"; }\n\n public get includeZero(): boolean | undefined { return this._includeZero; }\n public set includeZero(includeZero: boolean | undefined) { this._includeZero = includeZero ?? this._includeZero; }\n\n // default \"north\" is applied by the formatter (quarter rotation counter clockwise from east, the value depends on the units used)\n public get azimuthBase(): number | undefined { return this._azimuthBase; }\n public set azimuthBase(azimuthBase: number | undefined) { this._azimuthBase = azimuthBase; }\n\n public get azimuthBaseUnit(): UnitProps | undefined { return this._azimuthBaseUnit; }\n public set azimuthBaseUnit(azimuthBaseUnit: UnitProps | undefined) { this._azimuthBaseUnit = azimuthBaseUnit; }\n\n public get azimuthCounterClockwise(): boolean | undefined { return this._azimuthCounterClockwise; }\n public set azimuthCounterClockwise(azimuthCounterClockwise: boolean | undefined) { this._azimuthCounterClockwise = azimuthCounterClockwise; }\n public get azimuthClockwiseOrDefault(): boolean { return !this._azimuthCounterClockwise; }\n\n public get revolutionUnit(): UnitProps | undefined { return this._revolutionUnit; }\n public set revolutionUnit(revolutionUnit: UnitProps | undefined) { this._revolutionUnit = revolutionUnit; }\n\n /** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid FormatType. Throws exception if not valid. */\n public parseFormatTraits(formatTraitsFromJson: string | string[]) {\n const formatTraits = (Array.isArray(formatTraitsFromJson)) ? formatTraitsFromJson : formatTraitsFromJson.split(/,|;|\\|/);\n formatTraits.forEach((formatTraitsString: string) => { // for each element in the string array\n const formatTrait = parseFormatTrait(formatTraitsString, this.name);\n this._formatTraits = this.formatTraits | formatTrait;\n });\n }\n\n /** This method returns true if the formatTrait is set in this Format object. */\n public hasFormatTraitSet(formatTrait: FormatTraits): boolean {\n return (this._formatTraits & formatTrait) === formatTrait;\n }\n\n public loadFormatProperties(formatProps: FormatProps) {\n this._type = parseFormatType(formatProps.type, this.name);\n\n if (formatProps.precision !== undefined) {\n if (!Number.isInteger(formatProps.precision)) // mut be an integer\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'precision' attribute. It should be an integer.`);\n\n this._precision = parsePrecision(formatProps.precision, this._type, this.name);\n }\n if (this.type === FormatType.Scientific) {\n if (undefined === formatProps.scientificType) // if format type is scientific and scientific type is undefined, throw\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} is 'Scientific' type therefore the attribute 'scientificType' is required.`);\n\n this._scientificType = parseScientificType(formatProps.scientificType, this.name);\n }\n\n if (this.type === FormatType.Ratio){\n if (undefined === formatProps.ratioType)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} is 'Ratio' type therefore the attribute 'ratioType' is required.`);\n\n this._ratioType = parseRatioType(formatProps.ratioType, this.name);\n }\n\n if (undefined !== formatProps.roundFactor) { // optional; default is 0.0\n if (typeof (formatProps.roundFactor) !== \"number\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'roundFactor' attribute. It should be of type 'number'.`);\n if (formatProps.roundFactor !== this.roundFactor) // if roundFactor isn't default value of 0.0, reassign roundFactor variable\n this._roundFactor = formatProps.roundFactor;\n }\n\n if (undefined !== formatProps.minWidth) { // optional\n if (!Number.isInteger(formatProps.minWidth) || formatProps.minWidth < 0) // must be a positive int\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'minWidth' attribute. It should be a positive integer.`);\n this._minWidth = formatProps.minWidth;\n }\n if (FormatType.Station === this.type) {\n if (undefined === formatProps.stationOffsetSize)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} is 'Station' type therefore the attribute 'stationOffsetSize' is required.`);\n if (!Number.isInteger(formatProps.stationOffsetSize) || formatProps.stationOffsetSize < 0) // must be a positive int > 0\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationOffsetSize' attribute. It should be a positive integer.`);\n this._stationOffsetSize = formatProps.stationOffsetSize;\n }\n\n if (undefined !== formatProps.showSignOption) { // optional; default is \"onlyNegative\"\n this._showSignOption = parseShowSignOption(formatProps.showSignOption, this.name);\n }\n\n if (undefined !== formatProps.formatTraits && formatProps.formatTraits.length !== 0) { // FormatTraits is optional\n if (!Array.isArray(formatProps.formatTraits) && typeof (formatProps.formatTraits) !== \"string\") // must be either an array of strings or a string\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'formatTraits' attribute. It should be of type 'string' or 'string[]'.`);\n this.parseFormatTraits(formatProps.formatTraits); // check that all of the options for formatTraits are valid. If now, throw\n }\n\n if (undefined !== formatProps.decimalSeparator) { // optional\n if (typeof (formatProps.decimalSeparator) !== \"string\") // not a string or not a one character string\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'decimalSeparator' attribute. It should be of type 'string'.`);\n if (formatProps.decimalSeparator.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'decimalSeparator' attribute. It should be an empty or one character string.`);\n this._decimalSeparator = formatProps.decimalSeparator;\n }\n\n if (undefined !== formatProps.thousandSeparator) { // optional\n if (typeof (formatProps.thousandSeparator) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'thousandSeparator' attribute. It should be of type 'string'.`);\n if (formatProps.thousandSeparator.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'thousandSeparator' attribute. It should be an empty or one character string.`);\n this._thousandSeparator = formatProps.thousandSeparator;\n }\n\n if (undefined !== formatProps.uomSeparator) { // optional; default is \" \"\n if (typeof (formatProps.uomSeparator) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'uomSeparator' attribute. It should be of type 'string'.`);\n if (formatProps.uomSeparator.length < 0 || formatProps.uomSeparator.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'uomSeparator' attribute. It should be an empty or one character string.`);\n this._uomSeparator = formatProps.uomSeparator;\n }\n\n if (undefined !== formatProps.stationSeparator) { // optional; default is \"+\"\n if (typeof (formatProps.stationSeparator) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationSeparator' attribute. It should be of type 'string'.`);\n if (formatProps.stationSeparator.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationSeparator' attribute. It should be an empty or one character string.`);\n this._stationSeparator = formatProps.stationSeparator;\n }\n\n if (undefined !== formatProps.azimuthBase) { // optional; default is a quarter rotation (90 degrees) which represents north\n if (typeof (formatProps.azimuthBase) !== \"number\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'azimuthBase' attribute. It should be of type 'number'.`);\n this._azimuthBase = formatProps.azimuthBase;\n }\n\n if (undefined !== formatProps.azimuthCounterClockwise) { // optional; default is false\n if (typeof (formatProps.azimuthCounterClockwise) !== \"boolean\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'azimuthCounterClockwise' attribute. It should be of type 'boolean'.`);\n this._azimuthCounterClockwise = formatProps.azimuthCounterClockwise;\n }\n if (undefined !== formatProps.allowMathematicOperations) { // optional; default is false\n if (typeof (formatProps.allowMathematicOperations) !== \"boolean\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'allowMathematicOperations' attribute. It should be of type 'boolean'.`);\n this._allowMathematicOperations = formatProps.allowMathematicOperations;\n }\n }\n}\n\n/** A class used to define the specifications for formatting quantity values. This class is typically loaded by reading [[FormatProps]].\n * @beta\n */\nexport class Format extends BaseFormat {\n protected _units?: Array<[UnitProps, string | undefined]>;\n protected _customProps?: any; // used by custom formatters and parsers\n\n /** Constructor\n * @param name The name of a format specification. TODO: make optional or remove\n */\n constructor(name: string) {\n super(name);\n }\n\n public get units(): Array<[UnitProps, string | undefined]> | undefined { return this._units; }\n public get hasUnits(): boolean { return this._units !== undefined && this._units.length > 0; }\n public get customProps(): any { return this._customProps; }\n\n public static isFormatTraitSetInProps(formatProps: FormatProps, trait: FormatTraits) {\n if (!formatProps.formatTraits)\n return false;\n const formatTraits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : formatProps.formatTraits.split(/,|;|\\|/);\n const traitStr = getTraitString(trait);\n return formatTraits.find((traitEntry) => traitStr === traitEntry) ? true : false;\n }\n\n private async createUnit(unitsProvider: UnitsProvider, name: string, label?: string): Promise<void> {\n if (name === undefined || typeof (name) !== \"string\" || (label !== undefined && typeof (label) !== \"string\")) // throws if name is undefined or name isn't a string or if label is defined and isn't a string\n throw new QuantityError(QuantityStatus.InvalidJson, `This Composite has a unit with an invalid 'name' or 'label' attribute.`);\n for (const unit of this.units!) {\n const unitObj = unit[0].name;\n if (unitObj.toLowerCase() === name.toLowerCase()) // duplicate names are not allowed\n throw new QuantityError(QuantityStatus.InvalidJson, `The unit ${unitObj} has a duplicate name.`);\n }\n const newUnit: UnitProps = await unitsProvider.findUnitByName(name);\n if (!newUnit || !newUnit.isValid)\n throw new QuantityError(QuantityStatus.InvalidJson, `Invalid unit name '${name}'.`);\n this.units!.push([newUnit, label]);\n }\n\n /**\n * Clone Format\n */\n public clone(options?: CloneOptions): Format {\n const newFormat = new Format(this.name);\n newFormat._roundFactor = this._roundFactor;\n newFormat._type = this._type;\n newFormat._precision = this._precision;\n newFormat._minWidth = this._minWidth;\n newFormat._scientificType = this._scientificType;\n newFormat._showSignOption = this._showSignOption;\n newFormat._decimalSeparator = this._decimalSeparator;\n newFormat._thousandSeparator = this._thousandSeparator;\n newFormat._uomSeparator = this._uomSeparator;\n newFormat._stationSeparator = this._stationSeparator;\n newFormat._stationOffsetSize = this._stationOffsetSize;\n newFormat._formatTraits = this._formatTraits;\n newFormat._spacer = this._spacer;\n newFormat._includeZero = this._includeZero;\n newFormat._azimuthBase = this._azimuthBase;\n newFormat._azimuthBaseUnit = this._azimuthBaseUnit;\n newFormat._azimuthCounterClockwise = this._azimuthCounterClockwise;\n newFormat._ratioType = this._ratioType;\n newFormat._revolutionUnit = this._revolutionUnit;\n newFormat._customProps = this._customProps;\n this._units && (newFormat._units = [...this._units]);\n\n if (newFormat._units) {\n if (options?.showOnlyPrimaryUnit) {\n if (newFormat._units.length > 1)\n newFormat._units.length = 1;\n }\n }\n\n if (undefined !== options?.traits)\n newFormat._formatTraits = options?.traits;\n\n if (undefined !== options?.type)\n newFormat._type = options.type;\n\n if (undefined !== options?.precision) {\n // ensure specified precision is valid\n const precision = parsePrecision(options?.precision, newFormat._type, newFormat.name);\n newFormat._precision = precision;\n }\n\n if (undefined !== options?.primaryUnit) {\n if (options.primaryUnit.unit) {\n const newUnits = new Array<[UnitProps, string | undefined]>();\n newUnits.push([options.primaryUnit.unit, options.primaryUnit.label]);\n newFormat._units = newUnits;\n } else if (options.primaryUnit.label && newFormat._units?.length) {\n // update label only\n newFormat._units[0][1] = options.primaryUnit.label;\n }\n }\n return newFormat;\n }\n\n /**\n * Populates this Format with the values from the provided.\n */\n public async fromJSON(unitsProvider: UnitsProvider, jsonObj: FormatProps): Promise<void> {\n this.loadFormatProperties(jsonObj);\n\n if (isCustomFormatProps(jsonObj))\n this._customProps = jsonObj.custom;\n\n if (undefined !== jsonObj.composite) { // optional\n this._units = new Array<[UnitProps, string | undefined]>();\n if (jsonObj.composite.includeZero !== undefined) {\n if (typeof (jsonObj.composite.includeZero) !== \"boolean\") // includeZero must be a boolean IF it is defined\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'includeZero' attribute. It should be of type 'boolean'.`);\n this._includeZero = jsonObj.composite.includeZero;\n }\n if (jsonObj.composite.spacer !== undefined) { // spacer must be a string IF it is defined\n if (typeof (jsonObj.composite.spacer) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'spacer' attribute. It must be of type 'string'.`);\n if (jsonObj.composite.spacer.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'spacer' attribute. It should be an empty or one character string.`);\n this._spacer = jsonObj.composite.spacer;\n }\n if (jsonObj.composite.units !== undefined) { // if composite is defined, it must be an array with 1-4 units\n if (!Array.isArray(jsonObj.composite.units)) { // must be an array\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'units' attribute. It must be of type 'array'`);\n }\n if (jsonObj.composite.units.length > 0 && jsonObj.composite.units.length <= 4) { // Composite requires 1-4 units\n try {\n const createUnitPromises: Array<Promise<void>> = [];\n for (const unit of jsonObj.composite.units) {\n createUnitPromises.push(this.createUnit(unitsProvider, unit.name, unit.label));\n }\n\n await Promise.all(createUnitPromises);\n } catch (e) {\n throw e;\n }\n }\n }\n if (undefined === this.units || this.units.length === 0)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with no valid 'units'`);\n }\n\n if(this.type === FormatType.Azimuth || this.type === FormatType.Bearing) {\n // these units cannot be loaded from loadFormatProperties() because they require an async call, and the method signature is already public\n\n if (undefined !== jsonObj.azimuthBaseUnit) {\n if (typeof (jsonObj.azimuthBaseUnit) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'azimuthBaseUnit' attribute. It should be of type 'string'.`);\n\n const baseUnit: UnitProps = await unitsProvider.findUnitByName(jsonObj.azimuthBaseUnit);\n if (!baseUnit || !baseUnit.isValid)\n throw new QuantityError(QuantityStatus.InvalidJson, `Invalid unit name '${jsonObj.azimuthBaseUnit}' for azimuthBaseUnit in Format '${this.name}'.`);\n\n this._azimuthBaseUnit = baseUnit;\n }\n\n if (undefined !== jsonObj.revolutionUnit) {\n if (typeof (jsonObj.revolutionUnit) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'revolutionUnit' attribute. It should be of type 'string'.`);\n\n const revolutionUnit: UnitProps = await unitsProvider.findUnitByName(jsonObj.revolutionUnit);\n if (!revolutionUnit || !revolutionUnit.isValid)\n throw new QuantityError(QuantityStatus.InvalidJson, `Invalid unit name '${jsonObj.revolutionUnit}' for revolutionUnit in Format '${this.name}'.`);\n\n this._revolutionUnit = revolutionUnit;\n }\n\n if (this._revolutionUnit === undefined)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} is 'Azimuth' or 'Bearing' type therefore the attribute 'revolutionUnit' is required.`);\n if (this._azimuthBase !== undefined && this._azimuthBaseUnit === undefined)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an 'azimuthBase' attribute therefore the attribute 'azimuthBaseUnit' is required.`);\n }\n }\n\n /** Create a Format from FormatProps */\n public static async createFromJSON(name: string, unitsProvider: UnitsProvider, formatProps: FormatProps) {\n const actualFormat = new Format(name);\n await actualFormat.fromJSON(unitsProvider, formatProps);\n return actualFormat;\n }\n\n /**\n * Returns a JSON object that contain the specification for this Format.\n */\n public toJSON(): FormatProps {\n let composite;\n if (this.units) {\n const units = this.units.map((value) => {\n if (undefined !== value[1])\n return { name: value[0].name, label: value[1] };\n else\n return { name: value[0].name };\n });\n\n composite = {\n spacer: this.spacer,\n includeZero: this.includeZero,\n units,\n };\n }\n\n const azimuthBaseUnit = this.azimuthBaseUnit ? this.azimuthBaseUnit.name : undefined;\n const revolutionUnit = this.revolutionUnit ? this.revolutionUnit.name : undefined;\n\n const baseFormatProps: FormatProps = {\n type: this.type,\n precision: this.precision,\n roundFactor: this.roundFactor,\n minWidth: this.minWidth,\n showSignOption: this.showSignOption,\n formatTraits: formatTraitsToArray(this.formatTraits),\n decimalSeparator: this.decimalSeparator,\n thousandSeparator: this.thousandSeparator,\n uomSeparator: this.uomSeparator,\n scientificType: this.scientificType ? this.scientificType : undefined,\n ratioType: this.ratioType,\n stationOffsetSize: this.stationOffsetSize,\n stationSeparator: this.stationSeparator,\n azimuthBase: this.azimuthBase,\n azimuthBaseUnit,\n azimuthCounterClockwise: this.azimuthCounterClockwise,\n revolutionUnit,\n composite,\n };\n\n if (this.customProps)\n return {\n ...baseFormatProps,\n custom: this.customProps,\n } as CustomFormatProps;\n\n return baseFormatProps;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Format.js","sourceRoot":"","sources":["../../../src/Formatter/Format.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,4CAAiD;AACjD,4CAA6D;AAE7D,+CAKuB;AACvB,6CAAiG;AAEjG,sFAAsF;AACtF,6JAA6J;AAE7J;;GAEG;AACH,MAAa,UAAU;IACb,KAAK,GAAG,EAAE,CAAC;IACT,YAAY,GAAW,GAAG,CAAC;IAC3B,KAAK,GAAe,wBAAU,CAAC,OAAO,CAAC,CAAC,iEAAiE;IACzG,UAAU,GAAW,8BAAgB,CAAC,GAAG,CAAC,CAAC,WAAW;IACtD,eAAe,GAAmB,4BAAc,CAAC,YAAY,CAAC,CAAC,iEAAiE;IAChI,iBAAiB,GAAW,6BAAiB,CAAC,8BAA8B,CAAC;IAC7E,kBAAkB,GAAW,6BAAiB,CAAC,+BAA+B,CAAC;IAC/E,aAAa,GAAG,GAAG,CAAC,CAAC,6EAA6E;IAClG,iBAAiB,GAAG,GAAG,CAAC,CAAC,2BAA2B;IACpD,aAAa,GAAiB,0BAAY,CAAC,aAAa,CAAC;IACzD,OAAO,GAAW,GAAG,CAAC,CAAC,2BAA2B;IAClD,YAAY,GAAY,IAAI,CAAC,CAAC,4BAA4B;IAC1D,SAAS,CAAU,CAAC,yBAAyB;IAC7C,eAAe,CAAkB,CAAC,sEAAsE;IACxG,kBAAkB,CAAU,CAAC,sDAAsD;IACnF,kBAAkB,CAAU,CAAC,6EAA6E;IAC1G,UAAU,CAAa,CAAC,2FAA2F;IACnH,YAAY,CAAU,C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uB;YACrD,cAAc;YACd,SAAS;SACV,CAAC;QAEF,IAAI,IAAI,CAAC,WAAW;YAClB,OAAO;gBACL,GAAG,eAAe;gBAClB,MAAM,EAAE,IAAI,CAAC,WAAW;aACJ,CAAC;QAEzB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAzOD,wBAyOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Quantity\n */\n\nimport { QuantityConstants } from \"../Constants\";\nimport { QuantityError, QuantityStatus } from \"../Exception\";\nimport { UnitProps, UnitsProvider } from \"../Interfaces\";\nimport {\n DecimalPrecision, FormatTraits, formatTraitsToArray, FormatType, FractionalPrecision,\n getTraitString, parseFormatTrait, parseFormatType, parsePrecision, parseRatioType, parseScientificType, parseShowSignOption,\n RatioType, ScientificType,\n ShowSignOption,\n} from \"./FormatEnums\";\nimport { CloneOptions, CustomFormatProps, FormatProps, isCustomFormatProps } from \"./Interfaces\";\n\n// cSpell:ignore ZERONORMALIZED, nosign, onlynegative, signalways, negativeparentheses\n// cSpell:ignore trailzeroes, keepsinglezero, zeroempty, keepdecimalpoint, applyrounding, fractiondash, showunitlabel, prependunitlabel, exponentonlynegative\n\n/** A base Format class with shared properties and functionality between quantity and ecschema-metadata Format classes\n * @beta\n */\nexport class BaseFormat {\n private _name = \"\";\n protected _roundFactor: number = 0.0;\n protected _type: FormatType = FormatType.Decimal; // required; options are decimal, fractional, scientific, station\n protected _precision: number = DecimalPrecision.Six; // required\n protected _showSignOption: ShowSignOption = ShowSignOption.OnlyNegative; // options: noSign, onlyNegative, signAlways, negativeParentheses\n protected _decimalSeparator: string = QuantityConstants.LocaleSpecificDecimalSeparator;\n protected _thousandSeparator: string = QuantityConstants.LocaleSpecificThousandSeparator;\n protected _uomSeparator = \" \"; // optional; default is \" \"; defined separator between magnitude and the unit\n protected _stationSeparator = \"+\"; // optional; default is \"+\"\n protected _formatTraits: FormatTraits = FormatTraits.Uninitialized;\n protected _spacer: string = \" \"; // optional; default is \" \"\n protected _includeZero: boolean = true; // optional; default is true\n protected _minWidth?: number; // optional; positive int\n protected _scientificType?: ScientificType; // required if type is scientific; options: normalized, zeroNormalized\n protected _stationOffsetSize?: number; // required when type is station; positive integer > 0\n protected _stationBaseFactor?: number; // optional positive integer base factor for station formatting; default is 1\n protected _ratioType?: RatioType; // required if type is ratio; options: oneToN, NToOne, ValueBased, useGreatestCommonDivisor\n protected _azimuthBase?: number; // value always clockwise from north\n protected _azimuthBaseUnit?: UnitProps; // unit for azimuthBase value\n protected _azimuthCounterClockwise?: boolean; // if set to true, azimuth values are returned counter-clockwise from base\n protected _revolutionUnit?: UnitProps; // unit that represents a revolution, required for bearing or azimuth types\n protected _allowMathematicOperations: boolean = false; // optional; enables calculating mathematic operations like addition and subtraction; default is false.\n\n constructor(name: string) {\n this._name = name;\n }\n\n public get name(): string { return this._name; }\n\n public get roundFactor(): number { return this._roundFactor; }\n public set roundFactor(roundFactor: number) { this._roundFactor = roundFactor; }\n\n public get type(): FormatType { return this._type; }\n public set type(formatType: FormatType) { this._type = formatType; }\n\n public get precision(): DecimalPrecision | FractionalPrecision { return this._precision; }\n public set precision(precision: DecimalPrecision | FractionalPrecision) { this._precision = precision; }\n\n public get minWidth(): number | undefined { return this._minWidth; }\n public set minWidth(minWidth: number | undefined) { this._minWidth = minWidth; }\n\n public get scientificType(): ScientificType | undefined { return this._scientificType; }\n public set scientificType(scientificType: ScientificType | undefined) { this._scientificType = scientificType; }\n\n public get ratioType(): RatioType | undefined { return this._ratioType; }\n public set ratioType(ratioType: RatioType | undefined) { this._ratioType = ratioType; }\n\n public get showSignOption(): ShowSignOption { return this._showSignOption; }\n public set showSignOption(showSignOption: ShowSignOption) { this._showSignOption = showSignOption; }\n\n public get decimalSeparator(): string { return this._decimalSeparator; }\n public set decimalSeparator(decimalSeparator: string) { this._decimalSeparator = decimalSeparator; }\n\n public get thousandSeparator(): string { return this._thousandSeparator; }\n public set thousandSeparator(thousandSeparator: string) { this._thousandSeparator = thousandSeparator; }\n\n public get uomSeparator(): string { return this._uomSeparator; }\n public set uomSeparator(uomSeparator: string) { this._uomSeparator = uomSeparator; }\n\n public get stationSeparator(): string { return this._stationSeparator; }\n public set stationSeparator(stationSeparator: string) { this._stationSeparator = stationSeparator; }\n\n public get stationOffsetSize(): number | undefined { return this._stationOffsetSize; }\n public set stationOffsetSize(stationOffsetSize: number | undefined) { stationOffsetSize = this._stationOffsetSize = stationOffsetSize; }\n\n /** Gets the station base factor used for station formatting. This is a positive integer that acts as a multiplier\n * for the base offset calculation. The default value is 1.\n */\n public get stationBaseFactor(): number | undefined {\n return this._stationBaseFactor;\n }\n public set stationBaseFactor(stationBaseFactor: number | undefined) {\n this._stationBaseFactor = stationBaseFactor;\n }\n\n public get allowMathematicOperations(): boolean { return this._allowMathematicOperations; }\n public set allowMathematicOperations(allowMathematicOperations: boolean) { this._allowMathematicOperations = allowMathematicOperations; }\n\n public get formatTraits(): FormatTraits { return this._formatTraits; }\n public set formatTraits(formatTraits: FormatTraits) { this._formatTraits = formatTraits; }\n\n public get spacer(): string | undefined { return this._spacer; }\n public set spacer(spacer: string | undefined) { this._spacer = spacer ?? this._spacer; }\n public get spacerOrDefault(): string { return this._spacer ?? \" \"; }\n\n public get includeZero(): boolean | undefined { return this._includeZero; }\n public set includeZero(includeZero: boolean | undefined) { this._includeZero = includeZero ?? this._includeZero; }\n\n // default \"north\" is applied by the formatter (quarter rotation counter clockwise from east, the value depends on the units used)\n public get azimuthBase(): number | undefined { return this._azimuthBase; }\n public set azimuthBase(azimuthBase: number | undefined) { this._azimuthBase = azimuthBase; }\n\n public get azimuthBaseUnit(): UnitProps | undefined { return this._azimuthBaseUnit; }\n public set azimuthBaseUnit(azimuthBaseUnit: UnitProps | undefined) { this._azimuthBaseUnit = azimuthBaseUnit; }\n\n public get azimuthCounterClockwise(): boolean | undefined { return this._azimuthCounterClockwise; }\n public set azimuthCounterClockwise(azimuthCounterClockwise: boolean | undefined) { this._azimuthCounterClockwise = azimuthCounterClockwise; }\n public get azimuthClockwiseOrDefault(): boolean { return !this._azimuthCounterClockwise; }\n\n public get revolutionUnit(): UnitProps | undefined { return this._revolutionUnit; }\n public set revolutionUnit(revolutionUnit: UnitProps | undefined) { this._revolutionUnit = revolutionUnit; }\n\n /** This method parses input string that is typically extracted for persisted JSON data and validates that the string is a valid FormatType. Throws exception if not valid. */\n public parseFormatTraits(formatTraitsFromJson: string | string[]) {\n const formatTraits = (Array.isArray(formatTraitsFromJson)) ? formatTraitsFromJson : formatTraitsFromJson.split(/,|;|\\|/);\n formatTraits.forEach((formatTraitsString: string) => { // for each element in the string array\n const formatTrait = parseFormatTrait(formatTraitsString, this.name);\n this._formatTraits = this.formatTraits | formatTrait;\n });\n }\n\n /** This method returns true if the formatTrait is set in this Format object. */\n public hasFormatTraitSet(formatTrait: FormatTraits): boolean {\n return (this._formatTraits & formatTrait) === formatTrait;\n }\n\n public loadFormatProperties(formatProps: FormatProps) {\n this._type = parseFormatType(formatProps.type, this.name);\n\n if (formatProps.precision !== undefined) {\n if (!Number.isInteger(formatProps.precision)) // mut be an integer\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'precision' attribute. It should be an integer.`);\n\n this._precision = parsePrecision(formatProps.precision, this._type, this.name);\n }\n if (this.type === FormatType.Scientific) {\n if (undefined === formatProps.scientificType) // if format type is scientific and scientific type is undefined, throw\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} is 'Scientific' type therefore the attribute 'scientificType' is required.`);\n\n this._scientificType = parseScientificType(formatProps.scientificType, this.name);\n }\n\n if (this.type === FormatType.Ratio){\n if (undefined === formatProps.ratioType)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} is 'Ratio' type therefore the attribute 'ratioType' is required.`);\n\n this._ratioType = parseRatioType(formatProps.ratioType, this.name);\n }\n\n if (undefined !== formatProps.roundFactor) { // optional; default is 0.0\n if (typeof (formatProps.roundFactor) !== \"number\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'roundFactor' attribute. It should be of type 'number'.`);\n if (formatProps.roundFactor !== this.roundFactor) // if roundFactor isn't default value of 0.0, reassign roundFactor variable\n this._roundFactor = formatProps.roundFactor;\n }\n\n if (undefined !== formatProps.minWidth) { // optional\n if (!Number.isInteger(formatProps.minWidth) || formatProps.minWidth < 0) // must be a positive int\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'minWidth' attribute. It should be a positive integer.`);\n this._minWidth = formatProps.minWidth;\n }\n if (FormatType.Station === this.type) {\n if (undefined === formatProps.stationOffsetSize)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} is 'Station' type therefore the attribute 'stationOffsetSize' is required.`);\n if (!Number.isInteger(formatProps.stationOffsetSize) || formatProps.stationOffsetSize <= 0) // must be a positive int > 0\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationOffsetSize' attribute. It should be a positive integer.`);\n this._stationOffsetSize = formatProps.stationOffsetSize;\n\n if (undefined !== formatProps.stationBaseFactor) {\n // optional - must be a positive integer\n if (!Number.isInteger(formatProps.stationBaseFactor) || formatProps.stationBaseFactor <= 0)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationBaseFactor' attribute. It should be a positive integer.`);\n this._stationBaseFactor = formatProps.stationBaseFactor;\n }\n }\n\n if (undefined !== formatProps.showSignOption) { // optional; default is \"onlyNegative\"\n this._showSignOption = parseShowSignOption(formatProps.showSignOption, this.name);\n }\n\n if (undefined !== formatProps.formatTraits && formatProps.formatTraits.length !== 0) { // FormatTraits is optional\n if (!Array.isArray(formatProps.formatTraits) && typeof (formatProps.formatTraits) !== \"string\") // must be either an array of strings or a string\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'formatTraits' attribute. It should be of type 'string' or 'string[]'.`);\n this.parseFormatTraits(formatProps.formatTraits); // check that all of the options for formatTraits are valid. If now, throw\n }\n\n if (undefined !== formatProps.decimalSeparator) { // optional\n if (typeof (formatProps.decimalSeparator) !== \"string\") // not a string or not a one character string\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'decimalSeparator' attribute. It should be of type 'string'.`);\n if (formatProps.decimalSeparator.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'decimalSeparator' attribute. It should be an empty or one character string.`);\n this._decimalSeparator = formatProps.decimalSeparator;\n }\n\n if (undefined !== formatProps.thousandSeparator) { // optional\n if (typeof (formatProps.thousandSeparator) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'thousandSeparator' attribute. It should be of type 'string'.`);\n if (formatProps.thousandSeparator.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'thousandSeparator' attribute. It should be an empty or one character string.`);\n this._thousandSeparator = formatProps.thousandSeparator;\n }\n\n if (undefined !== formatProps.uomSeparator) { // optional; default is \" \"\n if (typeof (formatProps.uomSeparator) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'uomSeparator' attribute. It should be of type 'string'.`);\n if (formatProps.uomSeparator.length < 0 || formatProps.uomSeparator.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'uomSeparator' attribute. It should be an empty or one character string.`);\n this._uomSeparator = formatProps.uomSeparator;\n }\n\n if (undefined !== formatProps.stationSeparator) { // optional; default is \"+\"\n if (typeof (formatProps.stationSeparator) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationSeparator' attribute. It should be of type 'string'.`);\n if (formatProps.stationSeparator.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'stationSeparator' attribute. It should be an empty or one character string.`);\n this._stationSeparator = formatProps.stationSeparator;\n }\n\n if (undefined !== formatProps.azimuthBase) { // optional; default is a quarter rotation (90 degrees) which represents north\n if (typeof (formatProps.azimuthBase) !== \"number\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'azimuthBase' attribute. It should be of type 'number'.`);\n this._azimuthBase = formatProps.azimuthBase;\n }\n\n if (undefined !== formatProps.azimuthCounterClockwise) { // optional; default is false\n if (typeof (formatProps.azimuthCounterClockwise) !== \"boolean\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'azimuthCounterClockwise' attribute. It should be of type 'boolean'.`);\n this._azimuthCounterClockwise = formatProps.azimuthCounterClockwise;\n }\n if (undefined !== formatProps.allowMathematicOperations) { // optional; default is false\n if (typeof (formatProps.allowMathematicOperations) !== \"boolean\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'allowMathematicOperations' attribute. It should be of type 'boolean'.`);\n this._allowMathematicOperations = formatProps.allowMathematicOperations;\n }\n }\n}\n\n/** A class used to define the specifications for formatting quantity values. This class is typically loaded by reading [[FormatProps]].\n * @beta\n */\nexport class Format extends BaseFormat {\n protected _units?: Array<[UnitProps, string | undefined]>;\n protected _customProps?: any; // used by custom formatters and parsers\n\n /** Constructor\n * @param name The name of a format specification. TODO: make optional or remove\n */\n constructor(name: string) {\n super(name);\n }\n\n public get units(): Array<[UnitProps, string | undefined]> | undefined { return this._units; }\n public get hasUnits(): boolean { return this._units !== undefined && this._units.length > 0; }\n public get customProps(): any { return this._customProps; }\n\n public static isFormatTraitSetInProps(formatProps: FormatProps, trait: FormatTraits) {\n if (!formatProps.formatTraits)\n return false;\n const formatTraits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : formatProps.formatTraits.split(/,|;|\\|/);\n const traitStr = getTraitString(trait);\n return formatTraits.find((traitEntry) => traitStr === traitEntry) ? true : false;\n }\n\n private async createUnit(unitsProvider: UnitsProvider, name: string, label?: string): Promise<void> {\n if (name === undefined || typeof (name) !== \"string\" || (label !== undefined && typeof (label) !== \"string\")) // throws if name is undefined or name isn't a string or if label is defined and isn't a string\n throw new QuantityError(QuantityStatus.InvalidJson, `This Composite has a unit with an invalid 'name' or 'label' attribute.`);\n for (const unit of this.units!) {\n const unitObj = unit[0].name;\n if (unitObj.toLowerCase() === name.toLowerCase()) // duplicate names are not allowed\n throw new QuantityError(QuantityStatus.InvalidJson, `The unit ${unitObj} has a duplicate name.`);\n }\n const newUnit: UnitProps = await unitsProvider.findUnitByName(name);\n if (!newUnit || !newUnit.isValid)\n throw new QuantityError(QuantityStatus.InvalidJson, `Invalid unit name '${name}'.`);\n this.units!.push([newUnit, label]);\n }\n\n /**\n * Clone Format\n */\n public clone(options?: CloneOptions): Format {\n const newFormat = new Format(this.name);\n newFormat._roundFactor = this._roundFactor;\n newFormat._type = this._type;\n newFormat._precision = this._precision;\n newFormat._minWidth = this._minWidth;\n newFormat._scientificType = this._scientificType;\n newFormat._showSignOption = this._showSignOption;\n newFormat._decimalSeparator = this._decimalSeparator;\n newFormat._thousandSeparator = this._thousandSeparator;\n newFormat._uomSeparator = this._uomSeparator;\n newFormat._stationSeparator = this._stationSeparator;\n newFormat._stationOffsetSize = this._stationOffsetSize;\n newFormat._stationBaseFactor = this._stationBaseFactor;\n newFormat._formatTraits = this._formatTraits;\n newFormat._spacer = this._spacer;\n newFormat._includeZero = this._includeZero;\n newFormat._azimuthBase = this._azimuthBase;\n newFormat._azimuthBaseUnit = this._azimuthBaseUnit;\n newFormat._azimuthCounterClockwise = this._azimuthCounterClockwise;\n newFormat._ratioType = this._ratioType;\n newFormat._revolutionUnit = this._revolutionUnit;\n newFormat._customProps = this._customProps;\n this._units && (newFormat._units = [...this._units]);\n\n if (newFormat._units) {\n if (options?.showOnlyPrimaryUnit) {\n if (newFormat._units.length > 1)\n newFormat._units.length = 1;\n }\n }\n\n if (undefined !== options?.traits)\n newFormat._formatTraits = options?.traits;\n\n if (undefined !== options?.type)\n newFormat._type = options.type;\n\n if (undefined !== options?.precision) {\n // ensure specified precision is valid\n const precision = parsePrecision(options?.precision, newFormat._type, newFormat.name);\n newFormat._precision = precision;\n }\n\n if (undefined !== options?.primaryUnit) {\n if (options.primaryUnit.unit) {\n const newUnits = new Array<[UnitProps, string | undefined]>();\n newUnits.push([options.primaryUnit.unit, options.primaryUnit.label]);\n newFormat._units = newUnits;\n } else if (options.primaryUnit.label && newFormat._units?.length) {\n // update label only\n newFormat._units[0][1] = options.primaryUnit.label;\n }\n }\n return newFormat;\n }\n\n /**\n * Populates this Format with the values from the provided.\n */\n public async fromJSON(unitsProvider: UnitsProvider, jsonObj: FormatProps): Promise<void> {\n this.loadFormatProperties(jsonObj);\n\n if (isCustomFormatProps(jsonObj))\n this._customProps = jsonObj.custom;\n\n if (undefined !== jsonObj.composite) { // optional\n this._units = new Array<[UnitProps, string | undefined]>();\n if (jsonObj.composite.includeZero !== undefined) {\n if (typeof (jsonObj.composite.includeZero) !== \"boolean\") // includeZero must be a boolean IF it is defined\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'includeZero' attribute. It should be of type 'boolean'.`);\n this._includeZero = jsonObj.composite.includeZero;\n }\n if (jsonObj.composite.spacer !== undefined) { // spacer must be a string IF it is defined\n if (typeof (jsonObj.composite.spacer) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'spacer' attribute. It must be of type 'string'.`);\n if (jsonObj.composite.spacer.length > 1)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'spacer' attribute. It should be an empty or one character string.`);\n this._spacer = jsonObj.composite.spacer;\n }\n if (jsonObj.composite.units !== undefined) { // if composite is defined, it must be an array with 1-4 units\n if (!Array.isArray(jsonObj.composite.units)) { // must be an array\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with an invalid 'units' attribute. It must be of type 'array'`);\n }\n if (jsonObj.composite.units.length > 0 && jsonObj.composite.units.length <= 4) { // Composite requires 1-4 units\n try {\n const createUnitPromises: Array<Promise<void>> = [];\n for (const unit of jsonObj.composite.units) {\n createUnitPromises.push(this.createUnit(unitsProvider, unit.name, unit.label));\n }\n\n await Promise.all(createUnitPromises);\n } catch (e) {\n throw e;\n }\n }\n }\n if (undefined === this.units || this.units.length === 0)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has a Composite with no valid 'units'`);\n }\n\n if(this.type === FormatType.Azimuth || this.type === FormatType.Bearing) {\n // these units cannot be loaded from loadFormatProperties() because they require an async call, and the method signature is already public\n\n if (undefined !== jsonObj.azimuthBaseUnit) {\n if (typeof (jsonObj.azimuthBaseUnit) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'azimuthBaseUnit' attribute. It should be of type 'string'.`);\n\n const baseUnit: UnitProps = await unitsProvider.findUnitByName(jsonObj.azimuthBaseUnit);\n if (!baseUnit || !baseUnit.isValid)\n throw new QuantityError(QuantityStatus.InvalidJson, `Invalid unit name '${jsonObj.azimuthBaseUnit}' for azimuthBaseUnit in Format '${this.name}'.`);\n\n this._azimuthBaseUnit = baseUnit;\n }\n\n if (undefined !== jsonObj.revolutionUnit) {\n if (typeof (jsonObj.revolutionUnit) !== \"string\")\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an invalid 'revolutionUnit' attribute. It should be of type 'string'.`);\n\n const revolutionUnit: UnitProps = await unitsProvider.findUnitByName(jsonObj.revolutionUnit);\n if (!revolutionUnit || !revolutionUnit.isValid)\n throw new QuantityError(QuantityStatus.InvalidJson, `Invalid unit name '${jsonObj.revolutionUnit}' for revolutionUnit in Format '${this.name}'.`);\n\n this._revolutionUnit = revolutionUnit;\n }\n\n if (this._revolutionUnit === undefined)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} is 'Azimuth' or 'Bearing' type therefore the attribute 'revolutionUnit' is required.`);\n if (this._azimuthBase !== undefined && this._azimuthBaseUnit === undefined)\n throw new QuantityError(QuantityStatus.InvalidJson, `The Format ${this.name} has an 'azimuthBase' attribute therefore the attribute 'azimuthBaseUnit' is required.`);\n }\n }\n\n /** Create a Format from FormatProps */\n public static async createFromJSON(name: string, unitsProvider: UnitsProvider, formatProps: FormatProps) {\n const actualFormat = new Format(name);\n await actualFormat.fromJSON(unitsProvider, formatProps);\n return actualFormat;\n }\n\n /**\n * Returns a JSON object that contain the specification for this Format.\n */\n public toJSON(): FormatProps {\n let composite;\n if (this.units) {\n const units = this.units.map((value) => {\n if (undefined !== value[1])\n return { name: value[0].name, label: value[1] };\n else\n return { name: value[0].name };\n });\n\n composite = {\n spacer: this.spacer,\n includeZero: this.includeZero,\n units,\n };\n }\n\n const azimuthBaseUnit = this.azimuthBaseUnit ? this.azimuthBaseUnit.name : undefined;\n const revolutionUnit = this.revolutionUnit ? this.revolutionUnit.name : undefined;\n\n const baseFormatProps: FormatProps = {\n type: this.type,\n precision: this.precision,\n roundFactor: this.roundFactor,\n minWidth: this.minWidth,\n showSignOption: this.showSignOption,\n formatTraits: formatTraitsToArray(this.formatTraits),\n decimalSeparator: this.decimalSeparator,\n thousandSeparator: this.thousandSeparator,\n uomSeparator: this.uomSeparator,\n scientificType: this.scientificType ? this.scientificType : undefined,\n ratioType: this.ratioType,\n stationOffsetSize: this.stationOffsetSize,\n stationSeparator: this.stationSeparator,\n stationBaseFactor: this.stationBaseFactor,\n azimuthBase: this.azimuthBase,\n azimuthBaseUnit,\n azimuthCounterClockwise: this.azimuthCounterClockwise,\n revolutionUnit,\n composite,\n };\n\n if (this.customProps)\n return {\n ...baseFormatProps,\n custom: this.customProps,\n } as CustomFormatProps;\n\n return baseFormatProps;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Formatter.d.ts","sourceRoot":"","sources":["../../../src/Formatter/Formatter.ts"],"names":[],"mappings":"AAI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AoFvC,OAAO,CAAC,MAAM,CAAC,cAAc;IAS7B,OAAO,CAAC,MAAM,CAAC,aAAa;IAc5B,OAAO,CAAC,MAAM,CAAC,WAAW;CAqC3B"}
|
|
@@ -303,13 +303,15 @@ class Formatter {
|
|
|
303
303
|
else /* if (usesStops)*/ {
|
|
304
304
|
// we assume that stopping value is always positive
|
|
305
305
|
posMagnitude = Math.floor(posMagnitude * precisionScale + FPV_ROUNDFACTOR) / precisionScale;
|
|
306
|
-
const
|
|
306
|
+
const baseFactor = spec.format.stationBaseFactor ?? 1;
|
|
307
|
+
const stationOffsetSize = spec.format.stationOffsetSize || 0; // Provide default if undefined
|
|
308
|
+
const denominator = baseFactor * Math.pow(10, stationOffsetSize);
|
|
307
309
|
const tVal = Math.floor(posMagnitude); // this is the integer part only
|
|
308
310
|
const hiPart = Math.floor(tVal / denominator);
|
|
309
311
|
const lowPart = tVal - hiPart * denominator;
|
|
310
312
|
const fract = posMagnitude - tVal;
|
|
311
313
|
const fractionPart = Math.floor(fract * precisionScale + FPV_ROUNDFACTOR);
|
|
312
|
-
const stationString = hiPart.toFixed(0) + spec.format.stationSeparator + lowPart.toFixed(0).padStart(
|
|
314
|
+
const stationString = hiPart.toFixed(0) + spec.format.stationSeparator + lowPart.toFixed(0).padStart(stationOffsetSize, "0");
|
|
313
315
|
let fractionString = "";
|
|
314
316
|
if (fractionPart > 0) {
|
|
315
317
|
fractionString = (fractionPart / precisionScale).toFixed(spec.format.precision);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Formatter.js","sourceRoot":"","sources":["../../../src/Formatter/Formatter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,4CAAiD;AACjD,4CAA6D;AAE7D,+CAA2I;AAC3I,0CAAwD;AAExD;;GAEG;AACH,MAAM,eAAe,GAAG,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,iBAAiB;IACb,SAAS,GAAW,CAAC,CAAC;IACtB,UAAU,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AC,cAAc,CAAC;gBAClE,IAAI,SAAS,GAAG,SAAS,GAAG,cAAc,CAAC;gBAC3C,IAAI,WAAW,GAAG,cAAc,CAAC;gBAEjC,MAAM,GAAG,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;gBAC9E,SAAS,IAAI,GAAG,CAAC;gBACjB,WAAW,IAAI,GAAG,CAAC;gBAEnB,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC;YAC/F;gBACE,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,sBAAsB,EAAE,cAAc,IAAI,CAAC,MAAM,CAAC,IAAI,uCAAuC,CAAC,CAAC;QAC1I,CAAC;IACH,CAAC;;AAhfH,8BAifC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Quantity\n */\n\nimport { QuantityConstants } from \"../Constants\";\nimport { QuantityError, QuantityStatus } from \"../Exception\";\nimport { FormatterSpec } from \"./FormatterSpec\";\nimport { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision, RatioType, ScientificType, ShowSignOption } from \"./FormatEnums\";\nimport { applyConversion, Quantity } from \"../Quantity\";\n\n/** rounding additive\n * @internal\n */\nconst FPV_ROUNDFACTOR = 0.50000000001;\n\n/** A private helper class used to format fraction part of value into a numerator and denominator.\n * @internal\n */\nclass FractionalNumeric {\n private _integral: number = 0;\n private _numerator: number = 0;\n private _denominator: number = 1;\n private _greatestCommonFactor: number = 1;\n private _textParts: string[] = [];\n\n constructor(value: number, precision: FractionalPrecision, reduce: boolean) {\n this.calculate(value, precision as number);\n this.formTextParts(reduce);\n }\n\n private calculate(value: number, denominator: number) {\n const positiveValue = Math.abs(value);\n this._denominator = denominator;\n this._integral = Math.floor(positiveValue);\n const fractionPart = positiveValue - this._integral;\n this._numerator = Math.floor(fractionPart * this._denominator + FPV_ROUNDFACTOR);\n\n if (0 !== denominator && (this._numerator / this._denominator) === 1) {\n this._numerator = 0;\n this._integral += 1;\n } else {\n this._greatestCommonFactor = FractionalNumeric.getGreatestCommonFactor(this._numerator, this._denominator);\n }\n }\n\n /** Determine the GCD given two values. This value can be used to reduce a fraction.\n * See algorithm description http://en.wikipedia.org/wiki/Euclidean_algorithm\n */\n public static getGreatestCommonFactor(numerator: number, denominator: number): number {\n let r;\n while (denominator !== 0) {\n r = numerator % denominator;\n numerator = denominator;\n denominator = r;\n }\n return (numerator < 0) ? -numerator : numerator;\n }\n\n public get greatestCommonFactor(): number { return this._greatestCommonFactor; }\n public get hasFractionPart(): boolean { return this._textParts.length > 0; }\n public get isZero(): boolean { return 0 === this._numerator; }\n\n public getIntegralString(): string {\n if (this._textParts.length > 0)\n return this._textParts[0];\n\n return \"\";\n }\n\n public getNumeratorString(): string {\n if (this._textParts.length >= 3)\n return this._textParts[1];\n\n return \"\";\n }\n\n public getDenominatorString(): string {\n if (this._textParts.length >= 3)\n return this._textParts[2];\n\n return \"\";\n }\n\n private formTextParts(reduce: boolean): void {\n let numerator = this._numerator;\n let denominator = this._denominator;\n\n if (reduce && this._greatestCommonFactor > 1) {\n numerator /= this.greatestCommonFactor;\n denominator /= this.greatestCommonFactor;\n }\n\n this._textParts.push(this._integral.toFixed(0));\n if (numerator > 0) {\n this._textParts.push(numerator.toFixed(0));\n this._textParts.push(denominator.toFixed(0));\n }\n }\n}\n\n/** A helper class that contains methods used to format quantity values based on a format that are defined via the Format class.\n * @beta\n */\nexport class Formatter {\n private static FPV_MINTHRESHOLD = 1.0e-14;\n\n private static isNegligible(value: number): boolean { return (Math.abs(value) < Formatter.FPV_MINTHRESHOLD); }\n\n /** Return floating point value rounded by specific rounding factor.\n * @param value Value to be rounded.\n * @param roundTo Rounding factor.\n */\n private static roundDouble(value: number, roundTo: number): number {\n if (Formatter.isNegligible(roundTo))\n return value;\n\n roundTo = Math.abs(roundTo);\n let rnd = FPV_ROUNDFACTOR + (value / roundTo);\n const iVal = Math.floor(rnd);\n rnd = iVal * roundTo;\n return (value < 0.0) ? -rnd : rnd;\n }\n\n /** Generate a formatted text string integer value insert 1000 separators if appropriate.\n * @param wholePart Integer value to be formatted.\n */\n private static integerPartToText(wholePart: number, spec: FormatterSpec): string {\n // build invariant string represent wholePart\n let formattedValue = wholePart.toFixed(0);\n\n if ((formattedValue.length > 3) && (spec.format.hasFormatTraitSet(FormatTraits.Use1000Separator) && (spec.format.thousandSeparator.length > 0))) {\n let numSeparators = Math.floor(formattedValue.length / 3);\n let groupLength = formattedValue.length % 3;\n\n if (groupLength === 0) {\n numSeparators = numSeparators - 1;\n groupLength = groupLength + 3;\n }\n\n let outString = formattedValue.substring(0, groupLength);\n\n for (let i = 1; i <= numSeparators; i += 1) {\n outString = outString + spec.format.thousandSeparator + formattedValue.substring(groupLength, groupLength + 3);\n groupLength = groupLength + 3;\n }\n\n formattedValue = outString;\n }\n\n return formattedValue;\n }\n\n /** Trim trailing \"0\" from the text that represent the fractional part of a floating point value.\n * @param strVal The value string.\n */\n private static trimTrailingZeroes(strVal: string): string {\n let lastNonZeroCharIndex = -1;\n for (let i = strVal.length - 1; i >= 0; i--) {\n if (strVal.charCodeAt(i) !== QuantityConstants.CHAR_DIGIT_ZERO) {\n lastNonZeroCharIndex = i;\n break;\n }\n }\n if (lastNonZeroCharIndex >= 0)\n return strVal.substring(0, lastNonZeroCharIndex + 1);\n return \"\";\n }\n\n /** Format a quantity value into a composite format such as ft-in or deg-min-sec.\n * @param compositeValue The value for this part of the composite\n * @param isLastPart If false the composite value should be a whole value, if true then the value should be formatted as a floating point value.\n * @param label Label for this part of the composite. This will be either the default unit label or a custom label specified the format specification.\n */\n private static formatCompositePart(compositeValue: number, isLastPart: boolean, label: string, spec: FormatterSpec): string {\n let componentText = \"\";\n if (!isLastPart) {\n componentText = Formatter.integerPartToText(compositeValue, spec);\n if(spec.format.minWidth) { // integerPartToText does not do this padding\n componentText = this.countAndPad(componentText, spec.format.minWidth);\n }\n } else {\n componentText = Formatter.formatMagnitude(compositeValue, spec);\n }\n\n if (spec.format.hasFormatTraitSet(FormatTraits.ShowUnitLabel)) {\n componentText = componentText + spec.format.uomSeparator + label;\n }\n\n return componentText;\n }\n\n /** Format a quantity value into a composite format such as ft-in or deg-min-sec.\n * @param magnitude quantity value\n * @param fromUnit quantity unit\n */\n private static formatComposite(magnitude: number, spec: FormatterSpec): string {\n const compositeStrings: string[] = [];\n\n // Caller will deal with appending +||-||() value sign as specified by formatting options so just format positive value\n let posMagnitude = Math.abs(magnitude);\n\n for (let i = 0; i < spec.unitConversions.length; i++) {\n const currentLabel = spec.unitConversions[i].label;\n const unitConversion = spec.unitConversions[i].conversion;\n\n if (i > 0 && unitConversion.factor < 1.0)\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} has a invalid unit specification.`);\n if (i > 0 && unitConversion.offset !== 0) // offset should only ever be defined for major unit\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} has a invalid unit specification.`);\n\n let unitValue = 0.0;\n if (spec.format.type === FormatType.Ratio){\n if (1 !== spec.format.units!.length)\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format '${spec.format.name}' with type 'ratio' must have exactly one unit.`);\n\n try {\n unitValue = applyConversion(posMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;\n } catch (e) {\n // The \"InvertingZero\" error is thrown when the value is zero and the conversion factor is inverted.\n // For ratio, we actually want to support this corner case and return \"1:0\" as the formatted value.\n if (e instanceof QuantityError && e.errorNumber === QuantityStatus.InvertingZero) {\n return \"1:0\";\n }\n }\n\n compositeStrings.push(this.formatRatio(unitValue, spec));\n continue;\n }\n\n unitValue = applyConversion(posMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;\n\n if (0 === i) {\n const precisionScale = Math.pow(10, 8); // use a fixed round off precision of 8 to avoid loss of precision in actual magnitude\n unitValue = Math.floor(unitValue * precisionScale + FPV_ROUNDFACTOR) / precisionScale;\n if ((Math.abs(unitValue) < 0.0001) && spec.format.hasFormatTraitSet(FormatTraits.ZeroEmpty))\n return \"\";\n }\n\n if (i < spec.format.units!.length - 1) {\n const wholePart = Math.floor(unitValue);\n const componentText = Formatter.formatCompositePart(wholePart, false, currentLabel, spec);\n posMagnitude = unitValue - wholePart;\n compositeStrings.push(componentText);\n } else {\n const componentText = Formatter.formatCompositePart(unitValue, true, currentLabel, spec);\n compositeStrings.push(componentText);\n }\n }\n\n return compositeStrings.join(spec.format.spacerOrDefault);\n }\n\n /** Format a quantity value into a single text string. Imitate how formatting done by server method NumericFormatSpec::FormatDouble.\n * @param magnitude quantity value\n */\n private static formatMagnitude(magnitude: number, spec: FormatterSpec): string {\n let posMagnitude = Math.abs(magnitude);\n if ((Math.abs(posMagnitude) < 0.0001) && spec.format.hasFormatTraitSet(FormatTraits.ZeroEmpty))\n return \"\";\n\n if (spec.format.hasFormatTraitSet(FormatTraits.ApplyRounding))\n posMagnitude = Math.abs(Formatter.roundDouble(magnitude, spec.format.roundFactor));\n\n const isSci = ((posMagnitude > 1.0e12) || spec.format.type === FormatType.Scientific);\n const isDecimal = (isSci || spec.format.type === FormatType.Decimal || spec.format.type === FormatType.Bearing || spec.format.type === FormatType.Azimuth) || spec.format.type === FormatType.Ratio;\n const isFractional = (!isDecimal && spec.format.type === FormatType.Fractional);\n /* const usesStops = spec.format.type === FormatType.Station; */\n const isPrecisionZero = spec.format.precision === DecimalPrecision.Zero;\n const isKeepSingleZero = spec.format.hasFormatTraitSet(FormatTraits.KeepSingleZero);\n const precisionScale = Math.pow(10.0, spec.format.precision);\n const isKeepTrailingZeroes = spec.format.hasFormatTraitSet(FormatTraits.TrailZeroes);\n let expInt = 0.0;\n\n if (isSci && (posMagnitude !== 0.0)) {\n let exp = Math.log10(posMagnitude);\n let negativeExp = false;\n if (exp < 0.0) {\n exp = -exp;\n negativeExp = true;\n }\n\n expInt = Math.floor(exp);\n if (spec.format.type === FormatType.Scientific) {\n if (spec.format.scientificType === ScientificType.ZeroNormalized && posMagnitude > 1.0)\n expInt += 1.0;\n else if (spec.format.scientificType === ScientificType.Normalized && posMagnitude < 1.0)\n expInt += 1.0;\n\n if (negativeExp)\n expInt = -expInt;\n }\n\n const factor = Math.pow(10.0, -expInt);\n posMagnitude *= factor;\n }\n\n let formattedValue = \"\";\n if (isDecimal) {\n const actualVal = isPrecisionZero ? posMagnitude + FPV_ROUNDFACTOR : posMagnitude + Formatter.FPV_MINTHRESHOLD;\n let wholePart = Math.floor(actualVal);\n let fractionPart = actualVal - wholePart;\n if (!isPrecisionZero) {\n fractionPart = Math.abs(fractionPart) * precisionScale + FPV_ROUNDFACTOR;\n if (fractionPart >= precisionScale) {\n wholePart += 1;\n fractionPart -= precisionScale;\n }\n }\n\n formattedValue = Formatter.integerPartToText(wholePart, spec);\n if (isPrecisionZero) {\n if (spec.format.hasFormatTraitSet(FormatTraits.KeepDecimalPoint) && !isKeepSingleZero)\n formattedValue = formattedValue + spec.format.decimalSeparator;\n else if (isKeepSingleZero)\n formattedValue = `${formattedValue + spec.format.decimalSeparator}0`;\n } else {\n fractionPart = Math.floor(fractionPart) / precisionScale;\n let fractionString = fractionPart.toFixed(spec.format.precision);\n // remove leading \"0.\"\n fractionString = fractionString.substring(2).padEnd(spec.format.precision, \"0\");\n if (!isKeepTrailingZeroes)\n fractionString = Formatter.trimTrailingZeroes(fractionString);\n\n if (fractionString.length > 0)\n formattedValue = formattedValue + spec.format.decimalSeparator + fractionString;\n else {\n if (spec.format.hasFormatTraitSet(FormatTraits.KeepDecimalPoint))\n formattedValue = formattedValue + spec.format.decimalSeparator + (isKeepSingleZero ? \"0\" : \"\");\n }\n }\n\n if (isSci) {\n const expString = `e${expInt.toFixed(0)}`;\n formattedValue = formattedValue + expString;\n }\n } else if (isFractional) {\n const fn = new FractionalNumeric(posMagnitude, spec.format.precision as FractionalPrecision, true);\n formattedValue = fn.getIntegralString();\n\n if (!fn.isZero && fn.hasFractionPart) {\n const wholeFractionSeparator = spec.format.hasFormatTraitSet(FormatTraits.FractionDash) ? \"-\" : \" \";\n const fractionString = `${fn.getNumeratorString()}/${fn.getDenominatorString()}`;\n formattedValue = formattedValue + wholeFractionSeparator + fractionString;\n }\n } else /* if (usesStops)*/ {\n // we assume that stopping value is always positive\n posMagnitude = Math.floor(posMagnitude * precisionScale + FPV_ROUNDFACTOR) / precisionScale;\n\n const denominator = (Math.pow(10, spec.format.stationOffsetSize!));\n const tVal = Math.floor(posMagnitude); // this is the integer part only\n const hiPart = Math.floor(tVal / denominator);\n const lowPart = tVal - hiPart * denominator;\n const fract = posMagnitude - tVal;\n const fractionPart = Math.floor(fract * precisionScale + FPV_ROUNDFACTOR);\n const stationString = hiPart.toFixed(0) + spec.format.stationSeparator + lowPart.toFixed(0).padStart(spec.format.stationOffsetSize!, \"0\");\n let fractionString = \"\";\n if (fractionPart > 0) {\n fractionString = (fractionPart/precisionScale).toFixed(spec.format.precision);\n // remove leading \"0.\"\n fractionString = fractionString.substring(2).padEnd(spec.format.precision, \"0\");\n if (!isKeepTrailingZeroes)\n fractionString = Formatter.trimTrailingZeroes(fractionString);\n\n formattedValue = stationString + spec.format.decimalSeparator + fractionString;\n } else {\n if (isKeepTrailingZeroes)\n fractionString = spec.format.decimalSeparator + \"\".padEnd(spec.format.precision, \"0\");\n else if (spec.format.hasFormatTraitSet(FormatTraits.KeepDecimalPoint))\n fractionString = spec.format.decimalSeparator;\n formattedValue = stationString + fractionString;\n }\n }\n\n if(spec.format.minWidth) {\n formattedValue = this.countAndPad(formattedValue, spec.format.minWidth);\n }\n\n return formattedValue;\n }\n\n private static countAndPad(value: string, minWidth: number): string {\n const regex = /[\\d,.]/g;\n const matches = value.match(regex);\n const count = matches ? matches.length : 0;\n if (count < minWidth) {\n value = value.padStart(minWidth, \"0\");\n }\n return value;\n }\n\n /** Format a quantity value into a single text string based on the current format specification of this class.\n * @param magnitude defines the value to spec.format.\n * @param spec A FormatterSpec object the defines specification for the magnitude and unit conversions for the formatter.\n */\n public static formatQuantity(magnitude: number, spec: FormatterSpec): string {\n const valueIsNegative = magnitude < 0.0;\n let prefix = \"\";\n let suffix = \"\";\n let formattedValue = \"\";\n if(spec.format.type === FormatType.Bearing || spec.format.type === FormatType.Azimuth) {\n const result = this.processBearingAndAzimuth(magnitude, spec);\n magnitude = result.magnitude;\n prefix = result.prefix ?? \"\";\n suffix = result.suffix ?? \"\";\n }\n\n switch (spec.format.showSignOption) {\n case ShowSignOption.NegativeParentheses:\n if (valueIsNegative) {\n prefix += \"(\";\n suffix = `)${suffix}`;\n }\n break;\n\n case ShowSignOption.OnlyNegative:\n if (valueIsNegative && spec.format.type !== FormatType.Bearing && spec.format.type !== FormatType.Azimuth)\n prefix += \"-\";\n\n break;\n\n case ShowSignOption.SignAlways:\n if (valueIsNegative)\n prefix += \"-\";\n else\n prefix += \"+\";\n\n break;\n\n case ShowSignOption.NoSign:\n default:\n break;\n }\n\n let formattedMagnitude = \"\";\n\n if (spec.format.hasUnits) {\n formattedMagnitude = Formatter.formatComposite(magnitude, spec);\n } else {\n // unitless quantity\n formattedMagnitude = Formatter.formatMagnitude(magnitude, spec);\n if (formattedMagnitude.length > 0 && spec.unitConversions.length > 0 && spec.format.hasFormatTraitSet(FormatTraits.ShowUnitLabel)) {\n if (spec.format.hasFormatTraitSet(FormatTraits.PrependUnitLabel))\n formattedMagnitude = spec.unitConversions[0].label + spec.format.uomSeparator + formattedMagnitude;\n else\n formattedMagnitude = formattedMagnitude + spec.format.uomSeparator + spec.unitConversions[0].label;\n }\n }\n // add Sign prefix and suffix as necessary\n if ((prefix.length > 0 || suffix.length > 0) && formattedMagnitude.length > 0)\n formattedValue = prefix + formattedMagnitude + suffix;\n else\n formattedValue = formattedMagnitude;\n\n return formattedValue;\n }\n\n private static processBearingAndAzimuth(magnitude: number, spec: FormatterSpec): {magnitude: number, prefix?: string, suffix?: string} {\n const type = spec.format.type;\n if (type !== FormatType.Bearing && type !== FormatType.Azimuth)\n return {magnitude};\n\n const revolution = this.getRevolution(spec);\n magnitude = this.normalizeAngle(magnitude, revolution);\n const quarterRevolution = revolution / 4;\n\n if (type === FormatType.Bearing) {\n let quadrant = 0;\n while (magnitude > quarterRevolution) {\n magnitude -= quarterRevolution;\n quadrant++;\n }\n let prefix, suffix: string;\n\n // Quadrants are\n // 3 0\n // 2 1\n // For quadrants 1 and 3 we have to subtract the angle from quarterRevolution degrees because they go counter-clockwise\n if (quadrant === 1 || quadrant === 3)\n magnitude = quarterRevolution - magnitude;\n\n // TODO: at some point we will want to open this for localization, in the first release it's going to be hard coded\n if (quadrant === 0 || quadrant === 3)\n prefix = \"N\";\n\n if (quadrant === 2 || quadrant === 1)\n prefix = \"S\";\n\n if (quadrant === 0 || quadrant === 1)\n suffix = \"E\";\n\n if (quadrant === 3 || quadrant === 2)\n suffix = \"W\";\n\n // special case, if in quadrant 2 and value is very close to quarter revolution (90°), turn prefix to N because N90:00:00W is preferred over S90:00:00W\n if (quadrant === 2 && spec.unitConversions.length > 0) {\n // To determine if value is small, we need to convert it to the smallest unit presented and use the provided precision on it\n const unitConversion = spec.unitConversions[spec.unitConversions.length - 1].conversion;\n const smallestFormattedDelta = applyConversion((quarterRevolution - magnitude), unitConversion) + this.FPV_MINTHRESHOLD;\n\n const precisionScale = Math.pow(10.0, spec.format.precision);\n const floor = Math.floor((smallestFormattedDelta) * precisionScale + FPV_ROUNDFACTOR) / precisionScale;\n if(floor === 0) {\n prefix = \"N\";\n }\n }\n\n return {magnitude, prefix, suffix: suffix!};\n }\n\n if (type === FormatType.Azimuth) {\n let azimuthBase = 0; // default base is North\n if (spec.format.azimuthBase !== undefined) {\n if (spec.azimuthBaseConversion === undefined) {\n throw new QuantityError(QuantityStatus.MissingRequiredProperty, `Missing azimuth base conversion for interpreting ${spec.name}'s azimuth base.`);\n }\n const azBaseQuantity: Quantity = new Quantity(spec.format.azimuthBaseUnit, spec.format.azimuthBase);\n const azBaseConverted = azBaseQuantity.convertTo(spec.persistenceUnit, spec.azimuthBaseConversion);\n if (azBaseConverted === undefined || !azBaseConverted.isValid) {\n throw new QuantityError(QuantityStatus.UnsupportedUnit, `Failed to convert azimuth base unit to ${spec.persistenceUnit.name}.`);\n }\n azimuthBase = this.normalizeAngle(azBaseConverted.magnitude, revolution);\n }\n\n if (azimuthBase === 0.0 && spec.format.azimuthClockwiseOrDefault)\n return {magnitude}; // no conversion necessary, the input is already using the result parameters (north base and clockwise)\n\n // subtract the base from the actual value\n magnitude -= azimuthBase;\n if (spec.format.azimuthClockwiseOrDefault)\n return {magnitude: this.normalizeAngle(magnitude, revolution)};\n\n // turn it into a counter-clockwise angle\n magnitude = revolution - magnitude;\n // normalize the result as it may have become negative or exceed the revolution\n magnitude = this.normalizeAngle(magnitude, revolution);\n }\n\n return {magnitude};\n }\n\n private static normalizeAngle(magnitude: number, revolution: number): number {\n magnitude = magnitude % revolution; // Strip anything that goes around more than once\n\n if (magnitude < 0) // If the value is negative, we want to normalize it to a positive angle\n magnitude += revolution;\n\n return magnitude;\n }\n\n private static getRevolution(spec: FormatterSpec): number {\n if (spec.revolutionConversion === undefined) {\n throw new QuantityError(QuantityStatus.MissingRequiredProperty, `Missing revolution unit conversion for calculating ${spec.name}'s revolution.`);\n }\n\n const revolution: Quantity = new Quantity(spec.format.revolutionUnit, 1.0);\n const converted = revolution.convertTo(spec.persistenceUnit, spec.revolutionConversion);\n if (converted === undefined || !converted.isValid) {\n throw new QuantityError(QuantityStatus.UnsupportedUnit, `Failed to convert revolution unit to ${spec.persistenceUnit.name}.`);\n }\n\n return converted.magnitude;\n }\n\n private static formatRatio(magnitude: number, spec: FormatterSpec): string {\n if (null === spec.format.ratioType)\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} must have a ratio type specified.`);\n\n const precisionScale = Math.pow(10.0, spec.format.precision);\n\n let reciprocal = 0;\n\n if (magnitude === 0.0)\n return \"0:1\";\n else\n reciprocal = 1.0/magnitude;\n\n switch (spec.format.ratioType) {\n case RatioType.OneToN:\n return `1:${this.formatMagnitude(reciprocal, spec)}`;\n case RatioType.NToOne:\n return `${this.formatMagnitude(magnitude, spec)}:1`;\n case RatioType.ValueBased:\n if (magnitude > 1.0)\n return `${this.formatMagnitude(magnitude, spec)}:1`;\n else\n return `1:${this.formatMagnitude(reciprocal, spec)}`;\n case RatioType.UseGreatestCommonDivisor:\n magnitude = Math.round(magnitude * precisionScale)/precisionScale;\n let numerator = magnitude * precisionScale;\n let denominator = precisionScale;\n\n const gcd = FractionalNumeric.getGreatestCommonFactor(numerator, denominator);\n numerator /= gcd;\n denominator /= gcd;\n\n return `${this.formatMagnitude(numerator, spec)}:${this.formatMagnitude(denominator, spec)}`;\n default:\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} has an invalid ratio type specified.`);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Formatter.js","sourceRoot":"","sources":["../../../src/Formatter/Formatter.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,4CAAiD;AACjD,4CAA6D;AAE7D,+CAA2I;AAC3I,0CAAwD;AAExD;;GAEG;AACH,MAAM,eAAe,GAAG,aAAa,CAAC;AAEtC;;GAEG;AACH,MAAM,iBAAiB;IACb,SAAS,GAAW,CAAC,CAAC;IACtB,UAAU,GAAW,CAAC,CAAC;IACvB,YAAY,GAAW,CAAC,CAAC;IACzB,qBAAqB,GAAW,CAAC,CAAC;IAClC,UAAU,GAAa,EAAE,CAAC;IAElC,YAAY,KAAa,EAAE,SAA8B,EAAE,MAAe;QACxE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,SAAmB,CAAC,CAAC;QAC3C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAEO,SAAS,CAAC,KAAa,EA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AC;gBAC9E,SAAS,IAAI,GAAG,CAAC;gBACjB,WAAW,IAAI,GAAG,CAAC;gBAEnB,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC;YAC/F;gBACE,MAAM,IAAI,yBAAa,CAAC,0BAAc,CAAC,sBAAsB,EAAE,cAAc,IAAI,CAAC,MAAM,CAAC,IAAI,uCAAuC,CAAC,CAAC;QAC1I,CAAC;IACH,CAAC;;AAlfH,8BAmfC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Quantity\n */\n\nimport { QuantityConstants } from \"../Constants\";\nimport { QuantityError, QuantityStatus } from \"../Exception\";\nimport { FormatterSpec } from \"./FormatterSpec\";\nimport { DecimalPrecision, FormatTraits, FormatType, FractionalPrecision, RatioType, ScientificType, ShowSignOption } from \"./FormatEnums\";\nimport { applyConversion, Quantity } from \"../Quantity\";\n\n/** rounding additive\n * @internal\n */\nconst FPV_ROUNDFACTOR = 0.50000000001;\n\n/** A private helper class used to format fraction part of value into a numerator and denominator.\n * @internal\n */\nclass FractionalNumeric {\n private _integral: number = 0;\n private _numerator: number = 0;\n private _denominator: number = 1;\n private _greatestCommonFactor: number = 1;\n private _textParts: string[] = [];\n\n constructor(value: number, precision: FractionalPrecision, reduce: boolean) {\n this.calculate(value, precision as number);\n this.formTextParts(reduce);\n }\n\n private calculate(value: number, denominator: number) {\n const positiveValue = Math.abs(value);\n this._denominator = denominator;\n this._integral = Math.floor(positiveValue);\n const fractionPart = positiveValue - this._integral;\n this._numerator = Math.floor(fractionPart * this._denominator + FPV_ROUNDFACTOR);\n\n if (0 !== denominator && (this._numerator / this._denominator) === 1) {\n this._numerator = 0;\n this._integral += 1;\n } else {\n this._greatestCommonFactor = FractionalNumeric.getGreatestCommonFactor(this._numerator, this._denominator);\n }\n }\n\n /** Determine the GCD given two values. This value can be used to reduce a fraction.\n * See algorithm description http://en.wikipedia.org/wiki/Euclidean_algorithm\n */\n public static getGreatestCommonFactor(numerator: number, denominator: number): number {\n let r;\n while (denominator !== 0) {\n r = numerator % denominator;\n numerator = denominator;\n denominator = r;\n }\n return (numerator < 0) ? -numerator : numerator;\n }\n\n public get greatestCommonFactor(): number { return this._greatestCommonFactor; }\n public get hasFractionPart(): boolean { return this._textParts.length > 0; }\n public get isZero(): boolean { return 0 === this._numerator; }\n\n public getIntegralString(): string {\n if (this._textParts.length > 0)\n return this._textParts[0];\n\n return \"\";\n }\n\n public getNumeratorString(): string {\n if (this._textParts.length >= 3)\n return this._textParts[1];\n\n return \"\";\n }\n\n public getDenominatorString(): string {\n if (this._textParts.length >= 3)\n return this._textParts[2];\n\n return \"\";\n }\n\n private formTextParts(reduce: boolean): void {\n let numerator = this._numerator;\n let denominator = this._denominator;\n\n if (reduce && this._greatestCommonFactor > 1) {\n numerator /= this.greatestCommonFactor;\n denominator /= this.greatestCommonFactor;\n }\n\n this._textParts.push(this._integral.toFixed(0));\n if (numerator > 0) {\n this._textParts.push(numerator.toFixed(0));\n this._textParts.push(denominator.toFixed(0));\n }\n }\n}\n\n/** A helper class that contains methods used to format quantity values based on a format that are defined via the Format class.\n * @beta\n */\nexport class Formatter {\n private static FPV_MINTHRESHOLD = 1.0e-14;\n\n private static isNegligible(value: number): boolean { return (Math.abs(value) < Formatter.FPV_MINTHRESHOLD); }\n\n /** Return floating point value rounded by specific rounding factor.\n * @param value Value to be rounded.\n * @param roundTo Rounding factor.\n */\n private static roundDouble(value: number, roundTo: number): number {\n if (Formatter.isNegligible(roundTo))\n return value;\n\n roundTo = Math.abs(roundTo);\n let rnd = FPV_ROUNDFACTOR + (value / roundTo);\n const iVal = Math.floor(rnd);\n rnd = iVal * roundTo;\n return (value < 0.0) ? -rnd : rnd;\n }\n\n /** Generate a formatted text string integer value insert 1000 separators if appropriate.\n * @param wholePart Integer value to be formatted.\n */\n private static integerPartToText(wholePart: number, spec: FormatterSpec): string {\n // build invariant string represent wholePart\n let formattedValue = wholePart.toFixed(0);\n\n if ((formattedValue.length > 3) && (spec.format.hasFormatTraitSet(FormatTraits.Use1000Separator) && (spec.format.thousandSeparator.length > 0))) {\n let numSeparators = Math.floor(formattedValue.length / 3);\n let groupLength = formattedValue.length % 3;\n\n if (groupLength === 0) {\n numSeparators = numSeparators - 1;\n groupLength = groupLength + 3;\n }\n\n let outString = formattedValue.substring(0, groupLength);\n\n for (let i = 1; i <= numSeparators; i += 1) {\n outString = outString + spec.format.thousandSeparator + formattedValue.substring(groupLength, groupLength + 3);\n groupLength = groupLength + 3;\n }\n\n formattedValue = outString;\n }\n\n return formattedValue;\n }\n\n /** Trim trailing \"0\" from the text that represent the fractional part of a floating point value.\n * @param strVal The value string.\n */\n private static trimTrailingZeroes(strVal: string): string {\n let lastNonZeroCharIndex = -1;\n for (let i = strVal.length - 1; i >= 0; i--) {\n if (strVal.charCodeAt(i) !== QuantityConstants.CHAR_DIGIT_ZERO) {\n lastNonZeroCharIndex = i;\n break;\n }\n }\n if (lastNonZeroCharIndex >= 0)\n return strVal.substring(0, lastNonZeroCharIndex + 1);\n return \"\";\n }\n\n /** Format a quantity value into a composite format such as ft-in or deg-min-sec.\n * @param compositeValue The value for this part of the composite\n * @param isLastPart If false the composite value should be a whole value, if true then the value should be formatted as a floating point value.\n * @param label Label for this part of the composite. This will be either the default unit label or a custom label specified the format specification.\n */\n private static formatCompositePart(compositeValue: number, isLastPart: boolean, label: string, spec: FormatterSpec): string {\n let componentText = \"\";\n if (!isLastPart) {\n componentText = Formatter.integerPartToText(compositeValue, spec);\n if(spec.format.minWidth) { // integerPartToText does not do this padding\n componentText = this.countAndPad(componentText, spec.format.minWidth);\n }\n } else {\n componentText = Formatter.formatMagnitude(compositeValue, spec);\n }\n\n if (spec.format.hasFormatTraitSet(FormatTraits.ShowUnitLabel)) {\n componentText = componentText + spec.format.uomSeparator + label;\n }\n\n return componentText;\n }\n\n /** Format a quantity value into a composite format such as ft-in or deg-min-sec.\n * @param magnitude quantity value\n * @param fromUnit quantity unit\n */\n private static formatComposite(magnitude: number, spec: FormatterSpec): string {\n const compositeStrings: string[] = [];\n\n // Caller will deal with appending +||-||() value sign as specified by formatting options so just format positive value\n let posMagnitude = Math.abs(magnitude);\n\n for (let i = 0; i < spec.unitConversions.length; i++) {\n const currentLabel = spec.unitConversions[i].label;\n const unitConversion = spec.unitConversions[i].conversion;\n\n if (i > 0 && unitConversion.factor < 1.0)\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} has a invalid unit specification.`);\n if (i > 0 && unitConversion.offset !== 0) // offset should only ever be defined for major unit\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} has a invalid unit specification.`);\n\n let unitValue = 0.0;\n if (spec.format.type === FormatType.Ratio){\n if (1 !== spec.format.units!.length)\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format '${spec.format.name}' with type 'ratio' must have exactly one unit.`);\n\n try {\n unitValue = applyConversion(posMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;\n } catch (e) {\n // The \"InvertingZero\" error is thrown when the value is zero and the conversion factor is inverted.\n // For ratio, we actually want to support this corner case and return \"1:0\" as the formatted value.\n if (e instanceof QuantityError && e.errorNumber === QuantityStatus.InvertingZero) {\n return \"1:0\";\n }\n }\n\n compositeStrings.push(this.formatRatio(unitValue, spec));\n continue;\n }\n\n unitValue = applyConversion(posMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;\n\n if (0 === i) {\n const precisionScale = Math.pow(10, 8); // use a fixed round off precision of 8 to avoid loss of precision in actual magnitude\n unitValue = Math.floor(unitValue * precisionScale + FPV_ROUNDFACTOR) / precisionScale;\n if ((Math.abs(unitValue) < 0.0001) && spec.format.hasFormatTraitSet(FormatTraits.ZeroEmpty))\n return \"\";\n }\n\n if (i < spec.format.units!.length - 1) {\n const wholePart = Math.floor(unitValue);\n const componentText = Formatter.formatCompositePart(wholePart, false, currentLabel, spec);\n posMagnitude = unitValue - wholePart;\n compositeStrings.push(componentText);\n } else {\n const componentText = Formatter.formatCompositePart(unitValue, true, currentLabel, spec);\n compositeStrings.push(componentText);\n }\n }\n\n return compositeStrings.join(spec.format.spacerOrDefault);\n }\n\n /** Format a quantity value into a single text string. Imitate how formatting done by server method NumericFormatSpec::FormatDouble.\n * @param magnitude quantity value\n */\n private static formatMagnitude(magnitude: number, spec: FormatterSpec): string {\n let posMagnitude = Math.abs(magnitude);\n if ((Math.abs(posMagnitude) < 0.0001) && spec.format.hasFormatTraitSet(FormatTraits.ZeroEmpty))\n return \"\";\n\n if (spec.format.hasFormatTraitSet(FormatTraits.ApplyRounding))\n posMagnitude = Math.abs(Formatter.roundDouble(magnitude, spec.format.roundFactor));\n\n const isSci = ((posMagnitude > 1.0e12) || spec.format.type === FormatType.Scientific);\n const isDecimal = (isSci || spec.format.type === FormatType.Decimal || spec.format.type === FormatType.Bearing || spec.format.type === FormatType.Azimuth) || spec.format.type === FormatType.Ratio;\n const isFractional = (!isDecimal && spec.format.type === FormatType.Fractional);\n /* const usesStops = spec.format.type === FormatType.Station; */\n const isPrecisionZero = spec.format.precision === DecimalPrecision.Zero;\n const isKeepSingleZero = spec.format.hasFormatTraitSet(FormatTraits.KeepSingleZero);\n const precisionScale = Math.pow(10.0, spec.format.precision);\n const isKeepTrailingZeroes = spec.format.hasFormatTraitSet(FormatTraits.TrailZeroes);\n let expInt = 0.0;\n\n if (isSci && (posMagnitude !== 0.0)) {\n let exp = Math.log10(posMagnitude);\n let negativeExp = false;\n if (exp < 0.0) {\n exp = -exp;\n negativeExp = true;\n }\n\n expInt = Math.floor(exp);\n if (spec.format.type === FormatType.Scientific) {\n if (spec.format.scientificType === ScientificType.ZeroNormalized && posMagnitude > 1.0)\n expInt += 1.0;\n else if (spec.format.scientificType === ScientificType.Normalized && posMagnitude < 1.0)\n expInt += 1.0;\n\n if (negativeExp)\n expInt = -expInt;\n }\n\n const factor = Math.pow(10.0, -expInt);\n posMagnitude *= factor;\n }\n\n let formattedValue = \"\";\n if (isDecimal) {\n const actualVal = isPrecisionZero ? posMagnitude + FPV_ROUNDFACTOR : posMagnitude + Formatter.FPV_MINTHRESHOLD;\n let wholePart = Math.floor(actualVal);\n let fractionPart = actualVal - wholePart;\n if (!isPrecisionZero) {\n fractionPart = Math.abs(fractionPart) * precisionScale + FPV_ROUNDFACTOR;\n if (fractionPart >= precisionScale) {\n wholePart += 1;\n fractionPart -= precisionScale;\n }\n }\n\n formattedValue = Formatter.integerPartToText(wholePart, spec);\n if (isPrecisionZero) {\n if (spec.format.hasFormatTraitSet(FormatTraits.KeepDecimalPoint) && !isKeepSingleZero)\n formattedValue = formattedValue + spec.format.decimalSeparator;\n else if (isKeepSingleZero)\n formattedValue = `${formattedValue + spec.format.decimalSeparator}0`;\n } else {\n fractionPart = Math.floor(fractionPart) / precisionScale;\n let fractionString = fractionPart.toFixed(spec.format.precision);\n // remove leading \"0.\"\n fractionString = fractionString.substring(2).padEnd(spec.format.precision, \"0\");\n if (!isKeepTrailingZeroes)\n fractionString = Formatter.trimTrailingZeroes(fractionString);\n\n if (fractionString.length > 0)\n formattedValue = formattedValue + spec.format.decimalSeparator + fractionString;\n else {\n if (spec.format.hasFormatTraitSet(FormatTraits.KeepDecimalPoint))\n formattedValue = formattedValue + spec.format.decimalSeparator + (isKeepSingleZero ? \"0\" : \"\");\n }\n }\n\n if (isSci) {\n const expString = `e${expInt.toFixed(0)}`;\n formattedValue = formattedValue + expString;\n }\n } else if (isFractional) {\n const fn = new FractionalNumeric(posMagnitude, spec.format.precision as FractionalPrecision, true);\n formattedValue = fn.getIntegralString();\n\n if (!fn.isZero && fn.hasFractionPart) {\n const wholeFractionSeparator = spec.format.hasFormatTraitSet(FormatTraits.FractionDash) ? \"-\" : \" \";\n const fractionString = `${fn.getNumeratorString()}/${fn.getDenominatorString()}`;\n formattedValue = formattedValue + wholeFractionSeparator + fractionString;\n }\n } else /* if (usesStops)*/ {\n // we assume that stopping value is always positive\n posMagnitude = Math.floor(posMagnitude * precisionScale + FPV_ROUNDFACTOR) / precisionScale;\n\n const baseFactor = spec.format.stationBaseFactor ?? 1;\n const stationOffsetSize = spec.format.stationOffsetSize || 0; // Provide default if undefined\n const denominator = baseFactor * Math.pow(10, stationOffsetSize);\n const tVal = Math.floor(posMagnitude); // this is the integer part only\n const hiPart = Math.floor(tVal / denominator);\n const lowPart = tVal - hiPart * denominator;\n const fract = posMagnitude - tVal;\n const fractionPart = Math.floor(fract * precisionScale + FPV_ROUNDFACTOR);\n const stationString = hiPart.toFixed(0) + spec.format.stationSeparator + lowPart.toFixed(0).padStart(stationOffsetSize, \"0\");\n let fractionString = \"\";\n if (fractionPart > 0) {\n fractionString = (fractionPart/precisionScale).toFixed(spec.format.precision);\n // remove leading \"0.\"\n fractionString = fractionString.substring(2).padEnd(spec.format.precision, \"0\");\n if (!isKeepTrailingZeroes)\n fractionString = Formatter.trimTrailingZeroes(fractionString);\n\n formattedValue = stationString + spec.format.decimalSeparator + fractionString;\n } else {\n if (isKeepTrailingZeroes)\n fractionString = spec.format.decimalSeparator + \"\".padEnd(spec.format.precision, \"0\");\n else if (spec.format.hasFormatTraitSet(FormatTraits.KeepDecimalPoint))\n fractionString = spec.format.decimalSeparator;\n formattedValue = stationString + fractionString;\n }\n }\n\n if(spec.format.minWidth) {\n formattedValue = this.countAndPad(formattedValue, spec.format.minWidth);\n }\n\n return formattedValue;\n }\n\n private static countAndPad(value: string, minWidth: number): string {\n const regex = /[\\d,.]/g;\n const matches = value.match(regex);\n const count = matches ? matches.length : 0;\n if (count < minWidth) {\n value = value.padStart(minWidth, \"0\");\n }\n return value;\n }\n\n /** Format a quantity value into a single text string based on the current format specification of this class.\n * @param magnitude defines the value to spec.format.\n * @param spec A FormatterSpec object the defines specification for the magnitude and unit conversions for the formatter.\n */\n public static formatQuantity(magnitude: number, spec: FormatterSpec): string {\n const valueIsNegative = magnitude < 0.0;\n let prefix = \"\";\n let suffix = \"\";\n let formattedValue = \"\";\n if(spec.format.type === FormatType.Bearing || spec.format.type === FormatType.Azimuth) {\n const result = this.processBearingAndAzimuth(magnitude, spec);\n magnitude = result.magnitude;\n prefix = result.prefix ?? \"\";\n suffix = result.suffix ?? \"\";\n }\n\n switch (spec.format.showSignOption) {\n case ShowSignOption.NegativeParentheses:\n if (valueIsNegative) {\n prefix += \"(\";\n suffix = `)${suffix}`;\n }\n break;\n\n case ShowSignOption.OnlyNegative:\n if (valueIsNegative && spec.format.type !== FormatType.Bearing && spec.format.type !== FormatType.Azimuth)\n prefix += \"-\";\n\n break;\n\n case ShowSignOption.SignAlways:\n if (valueIsNegative)\n prefix += \"-\";\n else\n prefix += \"+\";\n\n break;\n\n case ShowSignOption.NoSign:\n default:\n break;\n }\n\n let formattedMagnitude = \"\";\n\n if (spec.format.hasUnits) {\n formattedMagnitude = Formatter.formatComposite(magnitude, spec);\n } else {\n // unitless quantity\n formattedMagnitude = Formatter.formatMagnitude(magnitude, spec);\n if (formattedMagnitude.length > 0 && spec.unitConversions.length > 0 && spec.format.hasFormatTraitSet(FormatTraits.ShowUnitLabel)) {\n if (spec.format.hasFormatTraitSet(FormatTraits.PrependUnitLabel))\n formattedMagnitude = spec.unitConversions[0].label + spec.format.uomSeparator + formattedMagnitude;\n else\n formattedMagnitude = formattedMagnitude + spec.format.uomSeparator + spec.unitConversions[0].label;\n }\n }\n // add Sign prefix and suffix as necessary\n if ((prefix.length > 0 || suffix.length > 0) && formattedMagnitude.length > 0)\n formattedValue = prefix + formattedMagnitude + suffix;\n else\n formattedValue = formattedMagnitude;\n\n return formattedValue;\n }\n\n private static processBearingAndAzimuth(magnitude: number, spec: FormatterSpec): {magnitude: number, prefix?: string, suffix?: string} {\n const type = spec.format.type;\n if (type !== FormatType.Bearing && type !== FormatType.Azimuth)\n return {magnitude};\n\n const revolution = this.getRevolution(spec);\n magnitude = this.normalizeAngle(magnitude, revolution);\n const quarterRevolution = revolution / 4;\n\n if (type === FormatType.Bearing) {\n let quadrant = 0;\n while (magnitude > quarterRevolution) {\n magnitude -= quarterRevolution;\n quadrant++;\n }\n let prefix, suffix: string;\n\n // Quadrants are\n // 3 0\n // 2 1\n // For quadrants 1 and 3 we have to subtract the angle from quarterRevolution degrees because they go counter-clockwise\n if (quadrant === 1 || quadrant === 3)\n magnitude = quarterRevolution - magnitude;\n\n // TODO: at some point we will want to open this for localization, in the first release it's going to be hard coded\n if (quadrant === 0 || quadrant === 3)\n prefix = \"N\";\n\n if (quadrant === 2 || quadrant === 1)\n prefix = \"S\";\n\n if (quadrant === 0 || quadrant === 1)\n suffix = \"E\";\n\n if (quadrant === 3 || quadrant === 2)\n suffix = \"W\";\n\n // special case, if in quadrant 2 and value is very close to quarter revolution (90°), turn prefix to N because N90:00:00W is preferred over S90:00:00W\n if (quadrant === 2 && spec.unitConversions.length > 0) {\n // To determine if value is small, we need to convert it to the smallest unit presented and use the provided precision on it\n const unitConversion = spec.unitConversions[spec.unitConversions.length - 1].conversion;\n const smallestFormattedDelta = applyConversion((quarterRevolution - magnitude), unitConversion) + this.FPV_MINTHRESHOLD;\n\n const precisionScale = Math.pow(10.0, spec.format.precision);\n const floor = Math.floor((smallestFormattedDelta) * precisionScale + FPV_ROUNDFACTOR) / precisionScale;\n if(floor === 0) {\n prefix = \"N\";\n }\n }\n\n return {magnitude, prefix, suffix: suffix!};\n }\n\n if (type === FormatType.Azimuth) {\n let azimuthBase = 0; // default base is North\n if (spec.format.azimuthBase !== undefined) {\n if (spec.azimuthBaseConversion === undefined) {\n throw new QuantityError(QuantityStatus.MissingRequiredProperty, `Missing azimuth base conversion for interpreting ${spec.name}'s azimuth base.`);\n }\n const azBaseQuantity: Quantity = new Quantity(spec.format.azimuthBaseUnit, spec.format.azimuthBase);\n const azBaseConverted = azBaseQuantity.convertTo(spec.persistenceUnit, spec.azimuthBaseConversion);\n if (azBaseConverted === undefined || !azBaseConverted.isValid) {\n throw new QuantityError(QuantityStatus.UnsupportedUnit, `Failed to convert azimuth base unit to ${spec.persistenceUnit.name}.`);\n }\n azimuthBase = this.normalizeAngle(azBaseConverted.magnitude, revolution);\n }\n\n if (azimuthBase === 0.0 && spec.format.azimuthClockwiseOrDefault)\n return {magnitude}; // no conversion necessary, the input is already using the result parameters (north base and clockwise)\n\n // subtract the base from the actual value\n magnitude -= azimuthBase;\n if (spec.format.azimuthClockwiseOrDefault)\n return {magnitude: this.normalizeAngle(magnitude, revolution)};\n\n // turn it into a counter-clockwise angle\n magnitude = revolution - magnitude;\n // normalize the result as it may have become negative or exceed the revolution\n magnitude = this.normalizeAngle(magnitude, revolution);\n }\n\n return {magnitude};\n }\n\n private static normalizeAngle(magnitude: number, revolution: number): number {\n magnitude = magnitude % revolution; // Strip anything that goes around more than once\n\n if (magnitude < 0) // If the value is negative, we want to normalize it to a positive angle\n magnitude += revolution;\n\n return magnitude;\n }\n\n private static getRevolution(spec: FormatterSpec): number {\n if (spec.revolutionConversion === undefined) {\n throw new QuantityError(QuantityStatus.MissingRequiredProperty, `Missing revolution unit conversion for calculating ${spec.name}'s revolution.`);\n }\n\n const revolution: Quantity = new Quantity(spec.format.revolutionUnit, 1.0);\n const converted = revolution.convertTo(spec.persistenceUnit, spec.revolutionConversion);\n if (converted === undefined || !converted.isValid) {\n throw new QuantityError(QuantityStatus.UnsupportedUnit, `Failed to convert revolution unit to ${spec.persistenceUnit.name}.`);\n }\n\n return converted.magnitude;\n }\n\n private static formatRatio(magnitude: number, spec: FormatterSpec): string {\n if (null === spec.format.ratioType)\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} must have a ratio type specified.`);\n\n const precisionScale = Math.pow(10.0, spec.format.precision);\n\n let reciprocal = 0;\n\n if (magnitude === 0.0)\n return \"0:1\";\n else\n reciprocal = 1.0/magnitude;\n\n switch (spec.format.ratioType) {\n case RatioType.OneToN:\n return `1:${this.formatMagnitude(reciprocal, spec)}`;\n case RatioType.NToOne:\n return `${this.formatMagnitude(magnitude, spec)}:1`;\n case RatioType.ValueBased:\n if (magnitude > 1.0)\n return `${this.formatMagnitude(magnitude, spec)}:1`;\n else\n return `1:${this.formatMagnitude(reciprocal, spec)}`;\n case RatioType.UseGreatestCommonDivisor:\n magnitude = Math.round(magnitude * precisionScale)/precisionScale;\n let numerator = magnitude * precisionScale;\n let denominator = precisionScale;\n\n const gcd = FractionalNumeric.getGreatestCommonFactor(numerator, denominator);\n numerator /= gcd;\n denominator /= gcd;\n\n return `${this.formatMagnitude(numerator, spec)}:${this.formatMagnitude(denominator, spec)}`;\n default:\n throw new QuantityError(QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} has an invalid ratio type specified.`);\n }\n }\n}\n"]}
|
|
@@ -24,6 +24,8 @@ export interface FormatProps {
|
|
|
24
24
|
/** conditionally required. */
|
|
25
25
|
readonly stationOffsetSize?: number;
|
|
26
26
|
readonly stationSeparator?: string;
|
|
27
|
+
/** Optional base factor for station formatting. A positive integer, defaults to 1. */
|
|
28
|
+
readonly stationBaseFactor?: number;
|
|
27
29
|
/** The base value for azimuth, specified from east counter-clockwise. */
|
|
28
30
|
readonly azimuthBase?: number;
|
|
29
31
|
/** The name of the unit for the azimuth base value. */
|