mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3640 File commands. New class RicfApplicationTools containing reusable functionality
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "RiaFilePathTools.h"
|
||||
|
||||
#include "RicfApplicationTools.h"
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
#include "ExportCommands/RicSaveEclipseInputVisibleCellsFeature.h"
|
||||
#include "ExportCommands/RicSaveEclipseInputVisibleCellsUi.h"
|
||||
@@ -80,7 +81,7 @@ void RicfExportVisibleCells::execute()
|
||||
return;
|
||||
}
|
||||
|
||||
auto eclipseView = viewFromCaseIdAndViewName(m_caseId, m_viewName);
|
||||
auto eclipseView = RicfApplicationTools::viewFromCaseIdAndViewName(m_caseId, m_viewName);
|
||||
if (!eclipseView)
|
||||
{
|
||||
RiaLogging::error(QString("exportVisibleCells: Could not find view '%1' in case ID %2").arg(m_viewName).arg(m_caseId));
|
||||
@@ -98,29 +99,6 @@ void RicfExportVisibleCells::execute()
|
||||
RicSaveEclipseInputVisibleCellsFeature::executeCommand(eclipseView, exportSettings, "exportVisibleCells");
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicfExportVisibleCells::viewFromCaseIdAndViewName(int caseId, const QString& viewName)
|
||||
{
|
||||
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
||||
{
|
||||
if (c->caseId() == caseId)
|
||||
{
|
||||
for (auto v : c->views())
|
||||
{
|
||||
auto eclipseView = dynamic_cast<RimEclipseView*>(v);
|
||||
if (eclipseView && eclipseView->name().compare(viewName, Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
return eclipseView;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user