MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::UnitSettings Namespace Reference

This abstracts away the UI measurement unit configuration. Internally this uses setDefaultUnitParams(). More...

Functions

void resetToDefaults ()
 Reset to some sane default.
bool getShowLeadingZero ()
 Common:
void setShowLeadingZero (bool show)
char getThousandsSeparator ()
void setThousandsSeparator (char ch)
std::optional< LengthUnitgetUiLengthUnit ()
 Length:
void setUiLengthUnit (std::optional< LengthUnit > unit, bool setPreferredLeadingZero)
std::optional< LengthUnitgetModelLengthUnit ()
void setModelLengthUnit (std::optional< LengthUnit > unit)
std::optional< LengthUnitgetActualModelLengthUnit ()
DegreesMode getDegreesMode ()
 Angle:
void setDegreesMode (DegreesMode mode, bool setPreferredPrecision)
int getUiLengthPrecision ()
 Precision:
void setUiLengthPrecision (int precision)
int getUiAnglePrecision ()
void setUiAnglePrecision (int precision)
int getUiRatioPrecision ()
void setUiRatioPrecision (int precision)

Detailed Description

This abstracts away the UI measurement unit configuration. Internally this uses setDefaultUnitParams().

Function Documentation

◆ getActualModelLengthUnit()

std::optional< LengthUnit > MR::UnitSettings::getActualModelLengthUnit ( )
nodiscard

Returns the units in which the coordinates are stored in the memory of MeshLib-based application; it is computes as getModelLengthUnit().or_else( getUiLengthUnit() ); this function is important for serialization in the formats with known length units

◆ getDegreesMode()

DegreesMode MR::UnitSettings::getDegreesMode ( )
nodiscard

Angle:

◆ getModelLengthUnit()

std::optional< LengthUnit > MR::UnitSettings::getModelLengthUnit ( )
nodiscard

Set "sourceUnit" for Length based dimensions, which reflects on scaling input data to match "targetUnit" Length based dimensions: length, speed, area, volume, etc This can be null to indicate "no unit".

◆ getShowLeadingZero()

bool MR::UnitSettings::getShowLeadingZero ( )
nodiscard

Common:

True: 0.1, false: .1.

◆ getThousandsSeparator()

char MR::UnitSettings::getThousandsSeparator ( )
nodiscard

Can be '\0' to indicate no separator. fractional == true means to the right of the fractional point, if any.

◆ getUiAnglePrecision()

int MR::UnitSettings::getUiAnglePrecision ( )
nodiscard

◆ getUiLengthPrecision()

int MR::UnitSettings::getUiLengthPrecision ( )
nodiscard

Precision:

Whether this means total number of digits or the number of digits after the decimal point depends on another setting (getDefaultUnitParams().style) that's currently not exposed in this file.

◆ getUiLengthUnit()

std::optional< LengthUnit > MR::UnitSettings::getUiLengthUnit ( )
nodiscard

Length:

Set "targetUnit" for Length based dimensions, which reflects on UI suffix Length based dimensions: length, speed, area, volume, etc This can be null to indicate "no unit". If setPreferredLeadingZero == true, will call setShowLeadingZero() to match this unit (currently inches = false, everything else = true).

◆ getUiRatioPrecision()

int MR::UnitSettings::getUiRatioPrecision ( )
nodiscard

◆ resetToDefaults()

void MR::UnitSettings::resetToDefaults ( )

Reset to some sane default.

◆ setDegreesMode()

void MR::UnitSettings::setDegreesMode ( DegreesMode mode,
bool setPreferredPrecision )

◆ setModelLengthUnit()

void MR::UnitSettings::setModelLengthUnit ( std::optional< LengthUnit > unit)

◆ setShowLeadingZero()

void MR::UnitSettings::setShowLeadingZero ( bool show)

◆ setThousandsSeparator()

void MR::UnitSettings::setThousandsSeparator ( char ch)

◆ setUiAnglePrecision()

void MR::UnitSettings::setUiAnglePrecision ( int precision)

◆ setUiLengthPrecision()

void MR::UnitSettings::setUiLengthPrecision ( int precision)

◆ setUiLengthUnit()

void MR::UnitSettings::setUiLengthUnit ( std::optional< LengthUnit > unit,
bool setPreferredLeadingZero )

◆ setUiRatioPrecision()

void MR::UnitSettings::setUiRatioPrecision ( int precision)