#3640 File commands. New class RicfApplicationTools containing reusable functionality

This commit is contained in:
Bjørn Erik Jensen
2018-11-07 15:42:45 +01:00
parent 06db391689
commit e8bf189116
15 changed files with 288 additions and 166 deletions

View File

@@ -18,6 +18,7 @@
#include "RicfExportWellPathCompletions.h"
#include "RicfApplicationTools.h"
#include "RicfCommandFileExecutor.h"
#include "RiaApplication.h"
@@ -66,6 +67,8 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
//--------------------------------------------------------------------------------------------------
void RicfExportWellPathCompletions::execute()
{
using TOOLS = RicfApplicationTools;
RimProject* project = RiaApplication::instance()->project();
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
@@ -95,21 +98,13 @@ void RicfExportWellPathCompletions::execute()
exportSettings->setCombinationMode(m_combinationMode());
{
bool foundCase = false;
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
{
if (c->caseId() == m_caseId())
{
exportSettings->caseToApply = c;
foundCase = true;
break;
}
}
if (!foundCase)
auto eclipseCase = TOOLS::caseFromId(m_caseId());
if (!eclipseCase)
{
RiaLogging::error(QString("exportWellPathCompletions: Could not find case with ID %1").arg(m_caseId()));
return;
}
exportSettings->caseToApply = eclipseCase;
}
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);