This class manages units, unit groups, and parameters and provides Conversion between
More...
|
static Unit | AddUnit (string unitName, string unitAbbrev, double a, double b, string baseGroupName) |
|
static double | FormatPrefix (double valueInOverrideUnit, BaseQuantity unit_group, out string prefixedUnit, out int power) |
| Takes as an input a value in override unit and tries to multiply or divide by 10 until a prefix can be found for the top and or bottom unit. Returns the values and outptus the new unit to be shown and power of 10 used to convert from the prefixed value to the value in override unit. More...
|
|
static string | FormatSIValue (double valueSI, int format, string groupName, out string prefixedUnit, out int power, bool automaticScaling, int scientificFigures) |
| Formats a value according to the options chosen by the user in the main form More...
|
|
static bool | ReadDB (XmlNode rootNode) |
|
static void | RemoveUnit (Unit remUnit) |
|
static double | RoundToSigFigs (this double value, int sigFigures) |
|
static XmlNode | SaveDB (XmlDocument xmlDoc) |
|
static List< List< string > > | SplitString (string unitExpression, bool invert, bool simplify=true) |
|
This class manages units, unit groups, and parameters and provides Conversion between
static double Greet.UnitLib.Units.FormatPrefix |
( |
double |
valueInOverrideUnit, |
|
|
BaseQuantity |
unit_group, |
|
|
out string |
prefixedUnit, |
|
|
out int |
power |
|
) |
| |
|
static |
Takes as an input a value in override unit and tries to multiply or divide by 10 until a prefix can be found for the top and or bottom unit. Returns the values and outptus the new unit to be shown and power of 10 used to convert from the prefixed value to the value in override unit.
Example: Calling the method with FormatPrefix(1250000, "energy", unit, pow); will return 1.25, unit = mmBtu, pow = 6
- Parameters
-
valueInOverrideUnit | Value in override unit to be converted |
unit_group | Unit group in which the value is defined |
prefixedUnit | Returns the unit and prefixes if necessary |
power | Returns the power of 10 used for the conversion |
- Returns
- Returns the value multiplied by the power of 10 returned
static string Greet.UnitLib.Units.FormatSIValue |
( |
double |
valueSI, |
|
|
int |
format, |
|
|
string |
groupName, |
|
|
out string |
prefixedUnit, |
|
|
out int |
power, |
|
|
bool |
automaticScaling, |
|
|
int |
scientificFigures |
|
) |
| |
|
static |
Formats a value according to the options chosen by the user in the main form
- Parameters
-
valueSI | The numerical value to be formated |
format | Optional format: 0 unitGroupFormat, 1 scientific notation, 2 all digits |
groupName | The unit or unit group in which this value is represented |
prefixedUnit | Returns the unit and prefixes if necessary |
power | Returns the power of 10 used for the conversion |
automaticScaling | If scaling is selected in the options the method will use prefixes like k for kilo, M for mega... Setting this option to false will disable that automatic scaling feature whatever the user selection is |
- Returns
- Formated value
Contains all of the unit groups.
The documentation for this class was generated from the following file:
- C:/Users/ddieffenthaler/Desktop/SVN/source/greet-dev/main/Lib/UnitLib/Units.cs