mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#272 Improved meta data for custom cell edge results
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include "cvfMath.h"
|
||||
|
||||
|
||||
@@ -41,21 +43,18 @@ RimCellEdgeColors::RimCellEdgeColors()
|
||||
CAF_PDM_InitObject("Cell Edge Result", ":/EdgeResult_1.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&enableCellEdgeColors, "EnableCellEdgeColors", true, "Enable cell edge results", "", "", "");
|
||||
enableCellEdgeColors.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&resultVariable, "CellEdgeVariable", "Result property", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultVariable, "CellEdgeVariable", "Result property", "", "", "");
|
||||
CAF_PDM_InitField(&useXVariable, "UseXVariable", true, "Use X values", "", "", "");
|
||||
CAF_PDM_InitField(&useYVariable, "UseYVariable", true, "Use Y values", "", "", "");
|
||||
CAF_PDM_InitField(&useZVariable, "UseZVariable", true, "Use Z values", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", ":/Legend.png", "", "");
|
||||
legendConfig.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_customFaultResultColors, "CustomEdgeResult", "Custom Edge Result", ":/CellResult.png", "", "");
|
||||
m_customFaultResultColors = new RimEclipseCellColors();
|
||||
m_customFaultResultColors.uiCapability()->setUiHidden(true);
|
||||
|
||||
resultVariable.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
m_resultVariable.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
|
||||
legendConfig = new RimLegendConfig();
|
||||
|
||||
@@ -89,9 +88,9 @@ void RimCellEdgeColors::loadResult()
|
||||
{
|
||||
CVF_ASSERT(m_reservoirView && m_reservoirView->currentGridCellResults());
|
||||
|
||||
if (resultVariable == RimCellEdgeColors::customEdgeResultUiText())
|
||||
if (m_resultVariable == RimCellEdgeColors::customEdgeResultUiText())
|
||||
{
|
||||
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, m_customFaultResultColors->resultVariable());
|
||||
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(m_customFaultResultColors->resultType(), m_customFaultResultColors->resultVariable());
|
||||
|
||||
for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
|
||||
{
|
||||
@@ -172,7 +171,7 @@ namespace caf
|
||||
|
||||
QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
if (fieldNeedingOptions == &resultVariable)
|
||||
if (fieldNeedingOptions == &m_resultVariable)
|
||||
{
|
||||
if (m_reservoirView && m_reservoirView->currentGridCellResults())
|
||||
{
|
||||
@@ -251,9 +250,9 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&resultVariable);
|
||||
uiOrdering.add(&m_resultVariable);
|
||||
|
||||
if (resultVariable().compare(RimCellEdgeColors::customEdgeResultUiText()) == 0)
|
||||
if (m_resultVariable().compare(RimCellEdgeColors::customEdgeResultUiText()) == 0)
|
||||
{
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Custom Edge Result");
|
||||
group1->add(&(m_customFaultResultColors->m_resultTypeUiField));
|
||||
@@ -267,7 +266,16 @@ void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
uiOrdering.add(&useZVariable);
|
||||
}
|
||||
|
||||
uiOrdering.forgetRemainingFields();
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
uiTreeOrdering.add(legendConfig());
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -277,7 +285,7 @@ QStringList RimCellEdgeColors::findResultVariableNames()
|
||||
{
|
||||
QStringList varNames;
|
||||
|
||||
if (m_reservoirView && m_reservoirView->currentGridCellResults() && !resultVariable().isEmpty())
|
||||
if (m_reservoirView && m_reservoirView->currentGridCellResults() && !m_resultVariable().isEmpty())
|
||||
{
|
||||
QStringList varList;
|
||||
varList = m_reservoirView->currentGridCellResults()->cellResults()->resultNames(RimDefines::STATIC_NATIVE);
|
||||
@@ -288,7 +296,7 @@ QStringList RimCellEdgeColors::findResultVariableNames()
|
||||
{
|
||||
if (RimDefines::isPerCellFaceResult(varList[i])) continue;
|
||||
|
||||
if (varList[i].startsWith(resultVariable))
|
||||
if (varList[i].startsWith(m_resultVariable))
|
||||
{
|
||||
varNames.append(varList[i]);
|
||||
}
|
||||
@@ -314,7 +322,7 @@ void RimCellEdgeColors::gridScalarIndices(size_t resultIndices[6])
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::gridScalarResultNames(QStringList* resultNames)
|
||||
void RimCellEdgeColors::gridScalarResultNames(std::vector<QString>* resultNames)
|
||||
{
|
||||
CVF_ASSERT(resultNames);
|
||||
|
||||
@@ -323,7 +331,36 @@ void RimCellEdgeColors::gridScalarResultNames(QStringList* resultNames)
|
||||
{
|
||||
resultNames->push_back(m_resultNameToIndexPairs[cubeFaceIndex].first);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::cellEdgeMetaData(std::vector<RimCellEdgeMetaData>* metaDataVector)
|
||||
{
|
||||
CVF_ASSERT(metaDataVector);
|
||||
|
||||
size_t resultIndices[6];
|
||||
this->gridScalarIndices(resultIndices);
|
||||
|
||||
std::vector<QString> resultNames;
|
||||
this->gridScalarResultNames(&resultNames);
|
||||
|
||||
bool isStatic = true;
|
||||
if (m_resultVariable == RimCellEdgeColors::customEdgeResultUiText())
|
||||
{
|
||||
isStatic = m_customFaultResultColors->resultType() == RimDefines::STATIC_NATIVE;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
{
|
||||
RimCellEdgeMetaData metaData;
|
||||
metaData.m_resultIndex = resultIndices[i];
|
||||
metaData.m_resultVariable = resultNames[i];
|
||||
metaData.m_isStatic = isStatic;
|
||||
|
||||
metaDataVector->push_back(metaData);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -368,7 +405,7 @@ bool RimCellEdgeColors::hasResult() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::updateIgnoredScalarValue()
|
||||
{
|
||||
if (resultVariable == "MULT" || resultVariable == "riMULT")
|
||||
if (m_resultVariable == "MULT" || m_resultVariable == "riMULT")
|
||||
{
|
||||
m_ignoredResultScalar = 1.0;
|
||||
}
|
||||
@@ -443,6 +480,29 @@ void RimCellEdgeColors::setEclipseCase(RimEclipseCase* eclipseCase)
|
||||
m_customFaultResultColors->setEclipseCase(eclipseCase);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeColors::setResultVariable(const QString& variableName)
|
||||
{
|
||||
m_resultVariable = variableName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellEdgeColors::resultVariable() const
|
||||
{
|
||||
if (m_resultVariable == RimCellEdgeColors::customEdgeResultUiText())
|
||||
{
|
||||
return m_customFaultResultColors->resultVariable();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_resultVariable;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user