![]() |
NDEVR
API Documentation
|
A unit that describes a simple scale (think meters vs feet). More...
Public Member Functions | |
| ScaledUnit (StringView name, TranslatedString translated_id, TranslatedString abbreviation, fltp08 scale) | |
| Constructs a ScaledUnit with the given scale factor and abbreviation. | |
| virtual const TranslatedString & | abbreviation (uint01 direction=X) const override |
| Returns the translated abbreviation for this unit. | |
| virtual Unit * | clone (const StringView &name, const TranslatedString &translated_id) const override |
| Creates a copy of this unit with a new name and display name. | |
| virtual fltp08 | convertFromString (const StringView &unit_string, uint01 direction=X) const override |
| Converts a unit-formatted string to a program-space value. | |
| virtual fltp08 | convertFromUnit (const fltp08 &program_space, const uint01 direction=X) const override |
| Converts a scalar from this unit back to program space by dividing by the scale. | |
| virtual Ray< 3, fltp08 > | convertFromUnit (const Ray< 3, fltp08 > &program_space) const override |
| Converts a 3D ray from this unit back to program space by dividing by the scale. | |
| virtual Vertex< 3, fltp08 > | convertFromUnit (const Vertex< 3, fltp08 > &program_space) const override |
| Converts a 3D vertex from this unit back to program space by dividing by the scale. | |
| virtual String | convertToString (const fltp08 &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const override |
| Converts a program-space scalar to a formatted display string. | |
| virtual fltp08 | convertToUnit (const fltp08 &program_space, const uint01 direction=X) const override |
| Converts a scalar from program space to this unit by multiplying by the scale. | |
| virtual Ray< 3, fltp08 > | convertToUnit (const Ray< 3, fltp08 > &program_space) const override |
| Converts a 3D ray from program space to this unit by multiplying by the scale. | |
| virtual Vertex< 3, fltp08 > | convertToUnit (const Vertex< 3, fltp08 > &program_space) const override |
| Converts a 3D vertex from program space to this unit by multiplying by the scale. | |
| virtual fltp08 | fromString (const StringView &unit_string, uint01 direction=X) const override |
| Parses a string directly into a numeric value in this unit's space. | |
| virtual Matrix< fltp08 > | matrix () const override |
| Returns the transformation matrix representing this unit's scale. | |
| virtual const Unit * | subUnit (uint01) const override |
| Returns the sub-unit for the given axis direction. | |
| Public Member Functions inherited from Unit | |
| Unit (StringView name, TranslatedString translated_id) | |
| Constructs a Unit with the given internal name and translated display name. | |
| virtual | ~Unit ()=default |
| Virtual destructor. | |
| virtual Unit * | clone () const |
| Creates a deep copy of this unit. | |
| template<class t_angle_type> | |
| Angle< t_angle_type > | convertAngleFromUnit (const fltp08 &unit_space, uint01 direction=X) const |
| Converts a scalar value in this unit's space back to an Angle in program space. | |
| template<class t_angle_type> | |
| String | convertToString (const Angle< t_angle_type > &program_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const |
| Converts an angle value from program space to a formatted string in this unit. | |
| template<class t_angle_type> | |
| fltp08 | convertToUnit (const Angle< t_angle_type > &program_space, uint01 direction=X) const |
| Converts an angle value from program space to this unit's scalar representation. | |
| virtual fltp08 | epsilon (fltp08 value, uint01 direction=X) const |
| Returns a small epsilon value appropriate for comparisons in this unit at the given magnitude. | |
| virtual StringView | getNextPreferredSeparator (const StringView ¤t_string, uint01 direction=X) const |
| Returns the next preferred separator character sequence based on the current input string. | |
| bool | operator== (const Unit &other) const |
| Checks equality between two units by comparing their matrices and names. | |
| virtual void | toFormula (StringAllocatingView &unit_string, uint01 direction=X) const |
| Writes the unit conversion as a formula into the given string. | |
| String | toString (const fltp08 &unit_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const |
| Formats a value already in this unit's space into a display string. | |
| virtual void | toString (String &string, const fltp08 &unit_space, bool add_comma, uint04 min_decimals, uint04 max_decimals, uint04 min_digits, bool include_abv=true, uint01 direction=X) const |
| Appends a formatted unit value to an existing string. | |
| virtual TranslatedString | translatedAxisName (uint04 index) const |
| Returns the translated axis name for a given axis index. | |
| TranslatedString | translatedName () const |
| Returns the translated display name of this unit. | |
Public Attributes | |
| const TranslatedString | core_abbreviation |
| The translated abbreviation displayed for this unit. | |
| const fltp08 | scale |
| The multiplicative scale factor used for conversion to this unit. | |
| Public Attributes inherited from Unit | |
| TranslatedString | axis_abbreviations [4] |
| Translated axis abbreviations for up to four axes. | |
| TranslatedString | axis_name_ids [4] |
| Translated axis names for up to four axes. | |
| const String | name |
| Internal identifier name for this unit. | |
| const TranslatedString | translated_id |
| Translated display name for this unit. | |
Additional Inherited Members | |
| Static Protected Member Functions inherited from Unit | |
| static Buffer< StringView > | OperatorSplit (const StringView &string) |
| Splits a string by operator characters for formula parsing. | |
A unit that describes a simple scale (think meters vs feet).
Definition at line 245 of file UnitTypes.h.
|
inline |
Constructs a ScaledUnit with the given scale factor and abbreviation.
| [in] | name | The internal identifier for this unit. |
| [in] | translated_id | The translated display name for this unit. |
| [in] | abbreviation | The translated abbreviation for this unit. |
| [in] | scale | The multiplicative scale factor for converting to this unit. |
Definition at line 257 of file UnitTypes.h.
References Unit::Unit(), abbreviation(), core_abbreviation, Unit::name, scale, and Unit::translated_id.
|
inlinenodiscardoverridevirtual |
Returns the translated abbreviation for this unit.
| [in] | direction | The axis direction. |
Implements Unit.
Definition at line 373 of file UnitTypes.h.
References core_abbreviation.
Referenced by AngleUnit::AngleUnit(), AngleUnit::AngleUnit(), DDMMSSAngleUnit::DDMMSSAngleUnit(), DDMMSSAngleUnit::DDMMSSAngleUnit(), and ScaledUnit().
|
nodiscardoverridevirtual |
Creates a copy of this unit with a new name and display name.
| [in] | name | The internal identifier for the cloned unit. |
| [in] | translated_id | The translated display name for the cloned unit. |
Implements Unit.
Reimplemented in AngleUnit, DDMMSSAngleUnit, ThreePartAngleUnit, TwoPartAngleUnit, and TwoPartUnit.
References Unit::Unit(), Unit::name, and Unit::translated_id.
|
inlinenodiscardoverridevirtual |
Converts a unit-formatted string to a program-space value.
| [in] | unit_string | The string representation of a value in this unit. |
| [in] | direction | The axis direction for the conversion. |
Reimplemented from Unit.
Definition at line 351 of file UnitTypes.h.
References convertFromUnit(), and fromString().
|
inlinenodiscardoverridevirtual |
Converts a scalar from this unit back to program space by dividing by the scale.
| [in] | program_space | The value in this unit's space. |
| [in] | direction | The axis direction for the conversion. |
Implements Unit.
Reimplemented in AngleUnit.
Definition at line 282 of file UnitTypes.h.
References scale.
Referenced by convertFromString().
|
inlinenodiscardoverridevirtual |
Converts a 3D ray from this unit back to program space by dividing by the scale.
| [in] | program_space | The ray in this unit's space. |
Implements Unit.
Reimplemented in AngleUnit.
Definition at line 324 of file UnitTypes.h.
References scale.
|
inlinenodiscardoverridevirtual |
Converts a 3D vertex from this unit back to program space by dividing by the scale.
| [in] | program_space | The vertex in this unit's space. |
Implements Unit.
Reimplemented in AngleUnit.
Definition at line 304 of file UnitTypes.h.
References scale.
|
inlinenodiscardoverridevirtual |
Converts a program-space scalar to a formatted display string.
| [in] | program_space | The value in program space. |
| [in] | add_comma | Whether to insert comma separators for large numbers. |
| [in] | min_decimals | The minimum number of decimal places to display. |
| [in] | max_decimals | The maximum number of decimal places to display. |
| [in] | min_digits | The minimum number of integer digits to display. |
| [in] | include_abv | Whether to append the unit abbreviation. |
| [in] | direction | The axis direction for the conversion. |
Reimplemented from Unit.
Definition at line 340 of file UnitTypes.h.
References convertToUnit(), and Unit::toString().
|
inlinenodiscardoverridevirtual |
Converts a scalar from program space to this unit by multiplying by the scale.
| [in] | program_space | The value in program space. |
| [in] | direction | The axis direction for the conversion. |
Implements Unit.
Reimplemented in AngleUnit.
Definition at line 269 of file UnitTypes.h.
References scale.
Referenced by convertToString().
|
inlinenodiscardoverridevirtual |
Converts a 3D ray from program space to this unit by multiplying by the scale.
| [in] | program_space | The ray in program space. |
Implements Unit.
Reimplemented in AngleUnit.
Definition at line 314 of file UnitTypes.h.
References scale.
|
inlinenodiscardoverridevirtual |
Converts a 3D vertex from program space to this unit by multiplying by the scale.
| [in] | program_space | The vertex in program space. |
Implements Unit.
Reimplemented in AngleUnit.
Definition at line 294 of file UnitTypes.h.
References scale.
|
inlinenodiscardoverridevirtual |
Parses a string directly into a numeric value in this unit's space.
| [in] | unit_string | The string to parse. |
| [in] | direction | The axis direction for the conversion. |
Reimplemented from Unit.
Reimplemented in DDMMSSAngleUnit, ThreePartAngleUnit, TwoPartAngleUnit, and TwoPartUnit.
Definition at line 362 of file UnitTypes.h.
References StringView::getAs().
Referenced by convertFromString().
Returns the transformation matrix representing this unit's scale.
Implements Unit.
Definition at line 393 of file UnitTypes.h.
References scale.
Returns the sub-unit for the given axis direction.
| [in] | direction | The axis direction. |
Implements Unit.
Definition at line 384 of file UnitTypes.h.
References Unit::Unit().