MeshLib C++ Docs
Loading...
Searching...
No Matches
MRUnitSettings.h
Go to the documentation of this file.
1#pragma once
2
3#include "exports.h"
4#include "MRUnits.h"
5
6// This abstracts away the UI measurement unit configuration. Internally this uses `setDefaultUnitParams()`.
7
9{
10
11// Reset to some sane default.
12MRVIEWER_API void resetToDefaults();
13
14// Common:
15
16// True: `0.1`, false: `.1`.
17[[nodiscard]] MRVIEWER_API bool getShowLeadingZero();
18MRVIEWER_API void setShowLeadingZero( bool show );
19
20// Can be '\0' to indicate no separator.
21// `fractional == true` means to the right of the fractional point, if any.
22[[nodiscard]] MRVIEWER_API char getThousandsSeparator();
23MRVIEWER_API void setThousandsSeparator( char ch );
24
25// Length:
26
27// Set "targetUnit" for Length based dimensions, which reflects on UI suffix
28// Length based dimensions: length, speed, area, volume, etc
29// This can be null to indicate "no unit".
30// If `setPreferredLeadingZero == true`, will call `setShowLeadingZero()` to match this unit (currently inches = false, everything else = true).
31[[nodiscard]] MRVIEWER_API std::optional<LengthUnit> getUiLengthUnit();
32MRVIEWER_API void setUiLengthUnit( std::optional<LengthUnit> unit, bool setPreferredLeadingZero );
33
34// Set "sourceUnit" for Length based dimensions, which reflects on scaling input data to match "targetUnit"
35// Length based dimensions: length, speed, area, volume, etc
36// This can be null to indicate "no unit".
37[[nodiscard]] MRVIEWER_API std::optional<LengthUnit> getModelLengthUnit();
38MRVIEWER_API void setModelLengthUnit( std::optional<LengthUnit> unit );
39
40// Angle:
41
42[[nodiscard]] MRVIEWER_API DegreesMode getDegreesMode();
43MRVIEWER_API void setDegreesMode( DegreesMode mode, bool setPreferredPrecision );
44
45// Precision:
46
47// Whether this means total number of digits or the number of digits after the decimal point depends
48// on another setting (`getDefaultUnitParams().style`) that's currently not exposed in this file.
49[[nodiscard]] MRVIEWER_API int getUiLengthPrecision();
50MRVIEWER_API void setUiLengthPrecision( int precision );
51
52[[nodiscard]] MRVIEWER_API int getUiAnglePrecision();
53MRVIEWER_API void setUiAnglePrecision( int precision );
54
55[[nodiscard]] MRVIEWER_API int getUiRatioPrecision();
56MRVIEWER_API void setUiRatioPrecision( int precision );
57
58}
Definition MRUnitSettings.h:9
MRVIEWER_API char getThousandsSeparator()
MRVIEWER_API void setThousandsSeparator(char ch)
MRVIEWER_API void setDegreesMode(DegreesMode mode, bool setPreferredPrecision)
MRVIEWER_API int getUiRatioPrecision()
MRVIEWER_API void setUiAnglePrecision(int precision)
MRVIEWER_API DegreesMode getDegreesMode()
MRVIEWER_API void setShowLeadingZero(bool show)
MRVIEWER_API void setUiRatioPrecision(int precision)
MRVIEWER_API std::optional< LengthUnit > getUiLengthUnit()
MRVIEWER_API void setUiLengthPrecision(int precision)
MRVIEWER_API bool getShowLeadingZero()
MRVIEWER_API void setModelLengthUnit(std::optional< LengthUnit > unit)
MRVIEWER_API void setUiLengthUnit(std::optional< LengthUnit > unit, bool setPreferredLeadingZero)
MRVIEWER_API void resetToDefaults()
MRVIEWER_API std::optional< LengthUnit > getModelLengthUnit()
MRVIEWER_API int getUiAnglePrecision()
MRVIEWER_API int getUiLengthPrecision()
DegreesMode
Definition MRUnits.h:258