#4319 Store export sector model settings

This commit is contained in:
Gaute Lindkvist 2019-04-14 16:10:59 +02:00
parent 0861a79dfa
commit 86e20df7c6
3 changed files with 74 additions and 20 deletions

View File

@ -40,6 +40,7 @@
#include "Riu3DMainWindowTools.h"
#include "RiuPropertyViewTabWidget.h"
#include "cafPdmSettings.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
@ -66,6 +67,11 @@ void RicExportEclipseSectorModelFeature::openDialogAndExecuteCommand(RimEclipseV
std::tie(min, max) = getVisibleCellRange(view, cellVisibility);
RicExportEclipseSectorModelUi exportSettings(caseData, min, max);
caf::PdmSettings::readFieldsFromApplicationStore(&exportSettings);
exportSettings.applyBoundaryDefaults();
exportSettings.removeInvalidKeywords();
RiuPropertyViewTabWidget propertyDialog(Riu3DMainWindowTools::mainWindowWidget(), &exportSettings, "Export Eclipse Sector Model", exportSettings.tabNames());
RicExportFeatureImpl::configureForExport(propertyDialog.dialogButtonBox());
@ -74,6 +80,8 @@ void RicExportEclipseSectorModelFeature::openDialogAndExecuteCommand(RimEclipseV
{
executeCommand(view, exportSettings, "ExportInputGrid");
}
caf::PdmSettings::writeFieldsToApplicationStore(&exportSettings);
}
//--------------------------------------------------------------------------------------------------

View File

@ -331,26 +331,7 @@ void RicExportEclipseSectorModelUi::fieldChangedByUi(const caf::PdmFieldHandle*
}
else if (changedField == &exportGridBox)
{
if (exportGridBox == ACTIVE_CELLS_BOX)
{
cvf::Vec3st minActive, maxActive;
m_caseData->activeCellInfo(RiaDefines::MATRIX_MODEL)->IJKBoundingBox(minActive, maxActive);
setMin(cvf::Vec3i(minActive));
setMax(cvf::Vec3i(maxActive));
}
else if (exportGridBox == VISIBLE_CELLS_BOX)
{
setMin(m_visibleMin);
setMax(m_visibleMax);
}
else if (exportGridBox == FULL_GRID_BOX)
{
const RigMainGrid* mainGrid = m_caseData->mainGrid();
cvf::Vec3i gridDimensions(int(mainGrid->cellCountI() - 1), int(mainGrid->cellCountJ() - 1), int(mainGrid->cellCountK() - 1));
setMin(cvf::Vec3i(0, 0, 0));
setMax(gridDimensions);
}
applyBoundaryDefaults();
this->updateConnectedEditors();
}
else if (changedField == &exportGridFilename)
@ -514,3 +495,66 @@ QString RicExportEclipseSectorModelUi::defaultFaultsFileName() const
QDir baseDir(defaultFolder());
return baseDir.absoluteFilePath("FAULTS.GRDECL");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportEclipseSectorModelUi::applyBoundaryDefaults()
{
if (exportGridBox == ACTIVE_CELLS_BOX)
{
cvf::Vec3st minActive, maxActive;
m_caseData->activeCellInfo(RiaDefines::MATRIX_MODEL)->IJKBoundingBox(minActive, maxActive);
setMin(cvf::Vec3i(minActive));
setMax(cvf::Vec3i(maxActive));
}
else if (exportGridBox == VISIBLE_CELLS_BOX)
{
setMin(m_visibleMin);
setMax(m_visibleMax);
}
else if (exportGridBox == FULL_GRID_BOX)
{
const RigMainGrid* mainGrid = m_caseData->mainGrid();
cvf::Vec3i gridDimensions(
int(mainGrid->cellCountI() - 1), int(mainGrid->cellCountJ() - 1), int(mainGrid->cellCountK() - 1));
setMin(cvf::Vec3i(0, 0, 0));
setMax(gridDimensions);
}
else
{
const RigMainGrid* mainGrid = m_caseData->mainGrid();
if (maxI() > (int) mainGrid->cellCountI())
{
maxI = (int) mainGrid->cellCountI();
}
if (maxJ() > (int) mainGrid->cellCountJ())
{
maxJ = (int) mainGrid->cellCountJ();
}
if (maxK() > (int) mainGrid->cellCountK())
{
maxK = (int) mainGrid->cellCountK();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportEclipseSectorModelUi::removeInvalidKeywords()
{
RigCaseCellResultsData* resultData = m_caseData->results(RiaDefines::MATRIX_MODEL);
std::vector<QString> validKeywords;
for (QString keyword : selectedKeywords())
{
if (resultData->hasResultEntry(RigEclipseResultAddress(RiaDefines::STATIC_NATIVE, keyword)))
{
validKeywords.push_back(keyword);
}
}
selectedKeywords.v().swap(validKeywords);
}

View File

@ -70,6 +70,8 @@ public:
cvf::Vec3i max() const;
void setMin(const cvf::Vec3i& min);
void setMax(const cvf::Vec3i& max);
void applyBoundaryDefaults();
void removeInvalidKeywords();
caf::PdmField<bool> exportGrid;
caf::PdmField<QString> exportGridFilename;