mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1769 Add time step filtering when importing model
Move import code from RiaApplication to command feature Show time step selection UI when importing Eclipse data Support time step reading of HDF data
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QDateTime>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -259,3 +260,49 @@ void RimTools::caseOptionItems(QList<caf::PdmOptionItemInfo>* options)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimTools::createTimeFormatStringFromDates(const std::vector<QDateTime>& dates)
|
||||
{
|
||||
bool hasHoursAndMinutesInTimesteps = false;
|
||||
bool hasSecondsInTimesteps = false;
|
||||
bool hasMillisecondsInTimesteps = false;
|
||||
|
||||
for (size_t i = 0; i < dates.size(); i++)
|
||||
{
|
||||
if (dates[i].time().msec() != 0.0)
|
||||
{
|
||||
hasMillisecondsInTimesteps = true;
|
||||
hasSecondsInTimesteps = true;
|
||||
hasHoursAndMinutesInTimesteps = true;
|
||||
break;
|
||||
}
|
||||
else if (dates[i].time().second() != 0.0)
|
||||
{
|
||||
hasHoursAndMinutesInTimesteps = true;
|
||||
hasSecondsInTimesteps = true;
|
||||
}
|
||||
else if (dates[i].time().hour() != 0.0 || dates[i].time().minute() != 0.0)
|
||||
{
|
||||
hasHoursAndMinutesInTimesteps = true;
|
||||
}
|
||||
}
|
||||
|
||||
QString formatString = "dd.MMM yyyy";
|
||||
if (hasHoursAndMinutesInTimesteps)
|
||||
{
|
||||
formatString += " - hh:mm";
|
||||
if (hasSecondsInTimesteps)
|
||||
{
|
||||
formatString += ":ss";
|
||||
if (hasMillisecondsInTimesteps)
|
||||
{
|
||||
formatString += ".zzz";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return formatString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user