mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3089 Move text parsing for unit conversion
This commit is contained in:
@@ -125,13 +125,13 @@ QString RiaEclipseUnitTools::unitStringPressure(UnitSystem unitSystem)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaEclipseUnitTools::convertToMeter(double sourceValue, const QString& unitText)
|
||||
double RiaEclipseUnitTools::convertToMeter(double sourceValue, const QString& sourceValueUnitText)
|
||||
{
|
||||
QString timmed = unitText.trimmed();
|
||||
QString timmed = sourceValueUnitText.trimmed();
|
||||
|
||||
if (timmed.compare("m", Qt::CaseInsensitive) == 0)
|
||||
if (timmed.compare("m", Qt::CaseInsensitive) == 0 || timmed.compare("md-m", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return sourceValue;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ double RiaEclipseUnitTools::convertToMeter(double sourceValue, const QString& un
|
||||
{
|
||||
return RiaEclipseUnitTools::inchToMeter(sourceValue);
|
||||
}
|
||||
else if (timmed.compare("ft", Qt::CaseInsensitive) == 0)
|
||||
else if (timmed.compare("ft", Qt::CaseInsensitive) == 0 || timmed.compare("md-ft", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return RiaEclipseUnitTools::feetToMeter(sourceValue);
|
||||
}
|
||||
@@ -152,13 +152,13 @@ double RiaEclipseUnitTools::convertToMeter(double sourceValue, const QString& un
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaEclipseUnitTools::convertToFeet(double sourceValue, const QString& unitText)
|
||||
double RiaEclipseUnitTools::convertToFeet(double sourceValue, const QString& sourceValueUnitText)
|
||||
{
|
||||
QString timmed = unitText.trimmed();
|
||||
QString timmed = sourceValueUnitText.trimmed();
|
||||
|
||||
if (timmed.compare("ft", Qt::CaseInsensitive) == 0)
|
||||
if (timmed.compare("ft", Qt::CaseInsensitive) == 0 || timmed.compare("md-ft", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return sourceValue;
|
||||
}
|
||||
@@ -171,11 +171,10 @@ double RiaEclipseUnitTools::convertToFeet(double sourceValue, const QString& uni
|
||||
double meter = sourceValue / 100.0;
|
||||
return RiaEclipseUnitTools::meterToFeet(meter);
|
||||
}
|
||||
else if (timmed.compare("m", Qt::CaseInsensitive) == 0)
|
||||
else if (timmed.compare("m", Qt::CaseInsensitive) == 0 || timmed.compare("md-m", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return RiaEclipseUnitTools::meterToFeet(sourceValue);
|
||||
}
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user