@@ -24,6 +24,7 @@ import { BeButtonEvent, BeModifierKeys, CoreTools, EventHandled, InputSource } f
2424import { ToolAssistance , ToolAssistanceImage , ToolAssistanceInputMethod , ToolAssistanceInstruction , ToolAssistanceSection } from "./ToolAssistance" ;
2525import { GraphicType } from "../common/render/GraphicType" ;
2626import { FormatterSpec } from "@itwin/core-quantity" ;
27+ import { QuantityType } from "../quantity-formatting/QuantityFormatter" ;
2728
2829function translateBold ( key : string ) {
2930 return `<b>${ CoreTools . translate ( `Measure.Labels.${ key } ` ) } :</b> ` ;
@@ -32,14 +33,32 @@ function translateBold(key: string) {
3233async function getFormatterSpecByKoQAndPersistenceUnit ( koq : string , persistenceUnitName : string ) : Promise < FormatterSpec | undefined > {
3334 const formatProps = await IModelApp . formatsProvider . getFormat ( koq ) ;
3435 if ( undefined === formatProps )
35- return undefined ;
36+ return getFormatterSpecByQuantityType ( koq ) ;
37+
3638 return IModelApp . quantityFormatter . createFormatterSpec ( {
3739 persistenceUnitName,
3840 formatProps,
3941 formatName : koq
4042 } ) ;
4143}
4244
45+ function getFormatterSpecByQuantityType ( koq : string ) : FormatterSpec | undefined {
46+ switch ( koq ) {
47+ case "DefaultToolsUnits.LENGTH" :
48+ return IModelApp . quantityFormatter . findFormatterSpecByQuantityType ( QuantityType . LengthEngineering ) ;
49+ case "DefaultToolsUnits.ANGLE" :
50+ return IModelApp . quantityFormatter . findFormatterSpecByQuantityType ( QuantityType . Angle ) ;
51+ case "DefaultToolsUnits.AREA" :
52+ return IModelApp . quantityFormatter . findFormatterSpecByQuantityType ( QuantityType . Area ) ;
53+ case "DefaultToolsUnits.VOLUME" :
54+ return IModelApp . quantityFormatter . findFormatterSpecByQuantityType ( QuantityType . Volume ) ;
55+ case "DefaultToolsUnits.LENGTH_COORDINATE" :
56+ return IModelApp . quantityFormatter . findFormatterSpecByQuantityType ( QuantityType . Coordinate ) ;
57+ default :
58+ return undefined ;
59+ }
60+ }
61+
4362/** @internal */
4463class MeasureLabel implements CanvasDecoration {
4564 public worldLocation = new Point3d ( ) ;
0 commit comments