mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 23:23:01 -06:00
Moved building of time step names for UI to case
This commit is contained in:
parent
c32f4cabfe
commit
06e8bc2ec5
@ -40,6 +40,9 @@ public:
|
||||
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath) = 0;
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &caseUserDescription; }
|
||||
|
||||
virtual QStringList timeStepStrings() { return QStringList(); }
|
||||
|
||||
protected:
|
||||
static QString relocateFile(const QString& fileName, const QString& newProjectPath, const QString& oldProjectPath,
|
||||
bool* foundFile, std::vector<QString>* searchedPaths);
|
||||
|
@ -408,3 +408,35 @@ std::vector<RimView*> RimEclipseCase::views()
|
||||
}
|
||||
return views;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimEclipseCase::timeStepStrings()
|
||||
{
|
||||
QStringList stringList;
|
||||
|
||||
std::vector<QDateTime> timeStepDates = results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(0);
|
||||
|
||||
bool showHoursAndMinutes = false;
|
||||
for (size_t i = 0; i < timeStepDates.size(); i++)
|
||||
{
|
||||
if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0)
|
||||
{
|
||||
showHoursAndMinutes = true;
|
||||
}
|
||||
}
|
||||
|
||||
QString formatString = "dd.MMM yyyy";
|
||||
if (showHoursAndMinutes)
|
||||
{
|
||||
formatString += " - hh:mm";
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < timeStepDates.size(); i++)
|
||||
{
|
||||
stringList += timeStepDates[i].toString(formatString);
|
||||
}
|
||||
|
||||
return stringList;
|
||||
}
|
||||
|
@ -85,7 +85,8 @@ public:
|
||||
RimIdenticalGridCaseGroup* parentGridCaseGroup();
|
||||
|
||||
virtual std::vector<RimView*> views();
|
||||
|
||||
virtual QStringList timeStepStrings();
|
||||
|
||||
// Overridden methods from PdmObject
|
||||
public:
|
||||
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "RiaPreferences.h"
|
||||
#include "RifOdbReader.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGeoMechCase, "ResInsightGeoMechCase");
|
||||
@ -129,3 +131,19 @@ void RimGeoMechCase::initAfterRead()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimGeoMechCase::timeStepStrings()
|
||||
{
|
||||
QStringList stringList;
|
||||
|
||||
std::vector<std::string> stepNames = geoMechData()->femPartResults()->stepNames();
|
||||
for (size_t i = 0; i < stepNames.size(); i++)
|
||||
{
|
||||
stringList += QString::fromStdString(stepNames[i]);
|
||||
}
|
||||
|
||||
return stringList;
|
||||
}
|
||||
|
@ -56,6 +56,9 @@ public:
|
||||
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath);
|
||||
virtual std::vector<RimView*> views();
|
||||
|
||||
virtual QStringList timeStepStrings();
|
||||
|
||||
|
||||
// Fields:
|
||||
caf::PdmChildArrayField<RimGeoMechView*> geoMechViews;
|
||||
|
||||
|
@ -799,12 +799,11 @@ void RiuMainWindow::refreshAnimationActions()
|
||||
m_animationToolBar->connectAnimationControl(animationControl);
|
||||
|
||||
QStringList timeStepStrings;
|
||||
|
||||
int currentTimeStepIndex = 0;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
bool enableAnimControls = false;
|
||||
RimView * activeView = app->activeReservoirView();
|
||||
RimView * activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (activeView &&
|
||||
activeView->viewer() &&
|
||||
activeView->viewer()->frameCount())
|
||||
@ -818,27 +817,7 @@ void RiuMainWindow::refreshAnimationActions()
|
||||
{
|
||||
if (activeRiv->isTimeStepDependentDataVisible())
|
||||
{
|
||||
std::vector<QDateTime> timeStepDates = activeRiv->currentGridCellResults()->cellResults()->timeStepDates(0);
|
||||
bool showHoursAndMinutes = false;
|
||||
for (size_t i = 0; i < timeStepDates.size(); i++)
|
||||
{
|
||||
if (timeStepDates[i].time().hour() != 0.0 || timeStepDates[i].time().minute() != 0.0)
|
||||
{
|
||||
showHoursAndMinutes = true;
|
||||
}
|
||||
}
|
||||
|
||||
QString formatString = "dd.MMM yyyy";
|
||||
if (showHoursAndMinutes)
|
||||
{
|
||||
formatString += " - hh:mm";
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < timeStepDates.size(); i++)
|
||||
{
|
||||
timeStepStrings += timeStepDates[i].toString(formatString);
|
||||
}
|
||||
currentTimeStepIndex = RiaApplication::instance()->activeReservoirView()->currentTimeStep();
|
||||
timeStepStrings = activeRiv->eclipseCase()->timeStepStrings();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -853,16 +832,13 @@ void RiuMainWindow::refreshAnimationActions()
|
||||
{
|
||||
if (activeGmv->isTimeStepDependentDataVisible())
|
||||
{
|
||||
std::vector<std::string> stepNames = activeGmv->geoMechCase()->geoMechData()->femPartResults()->stepNames();
|
||||
for (size_t i = 0; i < stepNames.size(); i++)
|
||||
{
|
||||
timeStepStrings += QString::fromStdString(stepNames[i]);
|
||||
}
|
||||
currentTimeStepIndex = RiaApplication::instance()->activeReservoirView()->currentTimeStep();
|
||||
activeGmv->geoMechCase()->timeStepStrings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentTimeStepIndex = activeView->currentTimeStep();
|
||||
|
||||
// Animation control is only relevant for more than one time step
|
||||
|
||||
if (timeStepStrings.size() < 2)
|
||||
@ -870,7 +846,7 @@ void RiuMainWindow::refreshAnimationActions()
|
||||
enableAnimControls = false;
|
||||
}
|
||||
|
||||
m_animationToolBar->setFrameRate(app->activeReservoirView()->maximumFrameRate());
|
||||
m_animationToolBar->setFrameRate(activeView->maximumFrameRate());
|
||||
}
|
||||
|
||||
m_animationToolBar->setTimeStepStrings(timeStepStrings);
|
||||
|
Loading…
Reference in New Issue
Block a user