24#ifndef UNITS_PROVIDER_H
25#define UNITS_PROVIDER_H
51 aSecondaryUnits = EDA_UNITS::MILS;
54 aSecondaryUnits = EDA_UNITS::MILLIMETRES;
56 aSecondaryUnits = EDA_UNITS::MILS;
66 return identityTransform;
87 aAddUnitLabel, aType );
111 aValue.value(), aAddUnitLabel, aType );
118 EDA_DATA_TYPE::DISTANCE );
131 aAddUnitLabel, aType );
138 EDA_DATA_TYPE::DISTANCE );
161 return KiROUND<double, int>( value );
185 return KiROUND<double, int>( value );
constexpr EDA_IU_SCALE unityScale
wxString MessageTextFromMinOptMax(const MINOPTMAX< int > &aValue) const
wxString MessageTextFromValue(const EDA_ANGLE &aValue, bool aAddUnitLabel=true) const
EDA_ANGLE AngleValueFromString(const wxString &aTextValue) const
const EDA_IU_SCALE & m_iuScale
const EDA_IU_SCALE & GetIuScale() const
virtual void GetUnitPair(EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits)
static const wxString NullUiString
The string that is used in the UI to represent a null value.
virtual ~UNITS_PROVIDER()
std::optional< int > OptionalValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aTextValue in aUnits to internal units used by the frame.
virtual ORIGIN_TRANSFORMS & GetOriginTransforms()
UNITS_PROVIDER(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits)
wxString StringFromOptionalValue(std::optional< int > aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts an optional aValue in internal units into a united string.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
EDA_UNITS GetUserUnits() const
void SetUserUnits(EDA_UNITS aUnits)
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aValue in internal units into a united string.
wxString StringFromValue(const EDA_ANGLE &aValue, bool aAddUnitLabel=false) const
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
Converts aTextValue in aUnits to internal units used by the frame.
EDA_DATA_TYPE
The type of unit.
KICOMMON_API wxString MessageTextFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A helper to convert the double length aValue to a string in inches, millimeters, or unscaled units.
KICOMMON_API wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Returns the string from aValue according to aUnits (inch, mm ...) for display.
KICOMMON_API wxString MessageTextFromMinOptMax(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const MINOPTMAX< int > &aValue)
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
KICOMMON_API bool IsImperialUnit(EDA_UNITS aUnit)