mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#272) Added visualization for custom cell edge results
This commit is contained in:
parent
ba5426bf41
commit
5c3f74b833
@ -21,9 +21,11 @@
|
|||||||
#include "RimCellEdgeColors.h"
|
#include "RimCellEdgeColors.h"
|
||||||
|
|
||||||
#include "RigCaseCellResultsData.h"
|
#include "RigCaseCellResultsData.h"
|
||||||
|
|
||||||
|
#include "RimEclipseCellColors.h"
|
||||||
|
#include "RimEclipseView.h"
|
||||||
#include "RimLegendConfig.h"
|
#include "RimLegendConfig.h"
|
||||||
#include "RimReservoirCellResultsStorage.h"
|
#include "RimReservoirCellResultsStorage.h"
|
||||||
#include "RimEclipseView.h"
|
|
||||||
|
|
||||||
#include "cafPdmUiListEditor.h"
|
#include "cafPdmUiListEditor.h"
|
||||||
#include "cvfMath.h"
|
#include "cvfMath.h"
|
||||||
@ -49,6 +51,10 @@ RimCellEdgeColors::RimCellEdgeColors()
|
|||||||
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", ":/Legend.png", "", "");
|
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", ":/Legend.png", "", "");
|
||||||
legendConfig.uiCapability()->setUiHidden(true);
|
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());
|
resultVariable.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||||
|
|
||||||
legendConfig = new RimLegendConfig();
|
legendConfig = new RimLegendConfig();
|
||||||
@ -63,6 +69,7 @@ RimCellEdgeColors::RimCellEdgeColors()
|
|||||||
RimCellEdgeColors::~RimCellEdgeColors()
|
RimCellEdgeColors::~RimCellEdgeColors()
|
||||||
{
|
{
|
||||||
delete legendConfig();
|
delete legendConfig();
|
||||||
|
delete m_customFaultResultColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -72,6 +79,7 @@ void RimCellEdgeColors::setReservoirView(RimEclipseView* ownerReservoirView)
|
|||||||
{
|
{
|
||||||
m_reservoirView = ownerReservoirView;
|
m_reservoirView = ownerReservoirView;
|
||||||
this->legendConfig()->setReservoirView(ownerReservoirView);
|
this->legendConfig()->setReservoirView(ownerReservoirView);
|
||||||
|
m_customFaultResultColors->setReservoirView(ownerReservoirView);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -81,30 +89,56 @@ void RimCellEdgeColors::loadResult()
|
|||||||
{
|
{
|
||||||
CVF_ASSERT(m_reservoirView && m_reservoirView->currentGridCellResults());
|
CVF_ASSERT(m_reservoirView && m_reservoirView->currentGridCellResults());
|
||||||
|
|
||||||
resetResultIndices();
|
if (resultVariable == RimCellEdgeColors::customEdgeResultUiText())
|
||||||
QStringList vars = findResultVariableNames();
|
|
||||||
updateIgnoredScalarValue();
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < vars.size(); ++i)
|
|
||||||
{
|
{
|
||||||
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, vars[i]);
|
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, m_customFaultResultColors->resultVariable());
|
||||||
int cubeFaceIdx;
|
|
||||||
for (cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
|
|
||||||
{
|
|
||||||
if ( ((cubeFaceIdx == 0 || cubeFaceIdx == 1) && useXVariable())
|
|
||||||
|| ((cubeFaceIdx == 2 || cubeFaceIdx == 3) && useYVariable())
|
|
||||||
|| ((cubeFaceIdx == 4 || cubeFaceIdx == 5) && useZVariable()))
|
|
||||||
{
|
|
||||||
QString varEnd = EdgeFaceEnum::textFromIndex(cubeFaceIdx);
|
|
||||||
|
|
||||||
if (vars[i].endsWith(varEnd))
|
for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
|
||||||
|
{
|
||||||
|
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(m_customFaultResultColors->resultVariable(), resultindex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resetResultIndices();
|
||||||
|
QStringList vars = findResultVariableNames();
|
||||||
|
updateIgnoredScalarValue();
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < vars.size(); ++i)
|
||||||
|
{
|
||||||
|
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(RimDefines::STATIC_NATIVE, vars[i]);
|
||||||
|
int cubeFaceIdx;
|
||||||
|
for (cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
|
||||||
|
{
|
||||||
|
if ( ((cubeFaceIdx == 0 || cubeFaceIdx == 1) && useXVariable())
|
||||||
|
|| ((cubeFaceIdx == 2 || cubeFaceIdx == 3) && useYVariable())
|
||||||
|
|| ((cubeFaceIdx == 4 || cubeFaceIdx == 5) && useZVariable()))
|
||||||
{
|
{
|
||||||
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(vars[i], resultindex);
|
QString varEnd = EdgeFaceEnum::textFromIndex(cubeFaceIdx);
|
||||||
|
|
||||||
|
if (vars[i].endsWith(varEnd))
|
||||||
|
{
|
||||||
|
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(vars[i], resultindex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateFieldVisibility();
|
||||||
|
|
||||||
|
updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimCellEdgeColors::initAfterRead()
|
||||||
|
{
|
||||||
|
m_customFaultResultColors->initAfterRead();
|
||||||
|
|
||||||
|
updateFieldVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -199,7 +233,9 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
optionList.push_front(caf::PdmOptionItemInfo( RimDefines::undefinedResultName(), "" ));
|
optionList.push_front(caf::PdmOptionItemInfo(RimDefines::undefinedResultName(), ""));
|
||||||
|
|
||||||
|
optionList.push_back(caf::PdmOptionItemInfo(RimCellEdgeColors::customEdgeResultUiText(), RimCellEdgeColors::customEdgeResultUiText()));
|
||||||
|
|
||||||
if (useOptionsOnly) *useOptionsOnly = true;
|
if (useOptionsOnly) *useOptionsOnly = true;
|
||||||
|
|
||||||
@ -210,6 +246,30 @@ QList<caf::PdmOptionItemInfo> RimCellEdgeColors::calculateValueOptions(const caf
|
|||||||
return QList<caf::PdmOptionItemInfo>();
|
return QList<caf::PdmOptionItemInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimCellEdgeColors::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||||
|
{
|
||||||
|
uiOrdering.add(&resultVariable);
|
||||||
|
|
||||||
|
if (resultVariable().compare(RimCellEdgeColors::customEdgeResultUiText()) == 0)
|
||||||
|
{
|
||||||
|
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Custom Edge Result");
|
||||||
|
group1->add(&(m_customFaultResultColors->m_resultTypeUiField));
|
||||||
|
group1->add(&(m_customFaultResultColors->m_porosityModelUiField));
|
||||||
|
group1->add(&(m_customFaultResultColors->m_resultVariableUiField));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uiOrdering.add(&useXVariable);
|
||||||
|
uiOrdering.add(&useYVariable);
|
||||||
|
uiOrdering.add(&useZVariable);
|
||||||
|
}
|
||||||
|
|
||||||
|
uiOrdering.forgetRemainingFields();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -266,6 +326,14 @@ void RimCellEdgeColors::gridScalarResultNames(QStringList* resultNames)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimCellEdgeColors::updateFieldVisibility()
|
||||||
|
{
|
||||||
|
m_customFaultResultColors->updateFieldVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -367,6 +435,14 @@ void RimCellEdgeColors::posNegClosestToZero(double& pos, double& neg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimCellEdgeColors::setEclipseCase(RimEclipseCase* eclipseCase)
|
||||||
|
{
|
||||||
|
m_customFaultResultColors->setEclipseCase(eclipseCase);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -29,10 +29,11 @@
|
|||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
class RigCaseCellResultsData;
|
class RigCaseCellResultsData;
|
||||||
|
class RimEclipseCase;
|
||||||
|
class RimEclipseCellColors;
|
||||||
class RimEclipseView;
|
class RimEclipseView;
|
||||||
class RimLegendConfig;
|
class RimLegendConfig;
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@ -54,6 +55,7 @@ public:
|
|||||||
typedef caf::AppEnum<RimCellEdgeColors::EdgeFaceType> EdgeFaceEnum;
|
typedef caf::AppEnum<RimCellEdgeColors::EdgeFaceType> EdgeFaceEnum;
|
||||||
|
|
||||||
void setReservoirView(RimEclipseView* ownerReservoirView);
|
void setReservoirView(RimEclipseView* ownerReservoirView);
|
||||||
|
void setEclipseCase(RimEclipseCase* eclipseCase);
|
||||||
|
|
||||||
caf::PdmField<QString> resultVariable;
|
caf::PdmField<QString> resultVariable;
|
||||||
caf::PdmField<bool> enableCellEdgeColors;
|
caf::PdmField<bool> enableCellEdgeColors;
|
||||||
@ -69,16 +71,21 @@ public:
|
|||||||
void posNegClosestToZero(double& pos, double& neg);
|
void posNegClosestToZero(double& pos, double& neg);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
virtual void initAfterRead();
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly );
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly );
|
||||||
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||||
|
|
||||||
QStringList findResultVariableNames();
|
QStringList findResultVariableNames();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void updateFieldVisibility();
|
||||||
|
|
||||||
void resetResultIndices();
|
void resetResultIndices();
|
||||||
void updateIgnoredScalarValue();
|
void updateIgnoredScalarValue();
|
||||||
|
|
||||||
|
static QString customEdgeResultUiText() { return "Custom Edge Result"; }
|
||||||
|
|
||||||
virtual caf::PdmFieldHandle* objectToggleField();
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
|
||||||
caf::PdmField<bool> useXVariable;
|
caf::PdmField<bool> useXVariable;
|
||||||
@ -88,5 +95,7 @@ private:
|
|||||||
caf::FixedArray<std::pair<QString, size_t>, 6 > m_resultNameToIndexPairs;
|
caf::FixedArray<std::pair<QString, size_t>, 6 > m_resultNameToIndexPairs;
|
||||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||||
double m_ignoredResultScalar;
|
double m_ignoredResultScalar;
|
||||||
|
|
||||||
|
caf::PdmChildField<RimEclipseCellColors*> m_customFaultResultColors;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
|
|
||||||
|
#include "RimCellEdgeColors.h"
|
||||||
#include "RimEclipseFaultColors.h"
|
#include "RimEclipseFaultColors.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimTernaryLegendConfig.h"
|
#include "RimTernaryLegendConfig.h"
|
||||||
@ -96,6 +97,12 @@ void RimEclipseCellColors::fieldChangedByUi(const caf::PdmFieldHandle* changedFi
|
|||||||
{
|
{
|
||||||
faultColors->updateConnectedEditors();
|
faultColors->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimCellEdgeColors* cellEdgeColors = dynamic_cast<RimCellEdgeColors*>(this->parentField()->ownerObject());
|
||||||
|
if (cellEdgeColors)
|
||||||
|
{
|
||||||
|
cellEdgeColors->updateConnectedEditors();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw();
|
if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw();
|
||||||
|
@ -56,6 +56,7 @@ protected:
|
|||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
|
||||||
friend class RimEclipseFaultColors;
|
friend class RimEclipseFaultColors;
|
||||||
|
friend class RimCellEdgeColors;
|
||||||
virtual void initAfterRead();
|
virtual void initAfterRead();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "RigCaseCellResultsData.h"
|
#include "RigCaseCellResultsData.h"
|
||||||
#include "RigCaseData.h"
|
#include "RigCaseData.h"
|
||||||
|
|
||||||
|
#include "RimCellEdgeColors.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
#include "RimEclipseCellColors.h"
|
#include "RimEclipseCellColors.h"
|
||||||
#include "RimEclipseFaultColors.h"
|
#include "RimEclipseFaultColors.h"
|
||||||
@ -180,6 +181,12 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
faultColors->updateConnectedEditors();
|
faultColors->updateConnectedEditors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RimCellEdgeColors* cellEdgeColors = dynamic_cast<RimCellEdgeColors*>(this->parentField()->ownerObject());
|
||||||
|
if (cellEdgeColors)
|
||||||
|
{
|
||||||
|
cellEdgeColors->updateConnectedEditors();
|
||||||
|
}
|
||||||
|
|
||||||
if (curve)
|
if (curve)
|
||||||
{
|
{
|
||||||
curve->updateConnectedEditors();
|
curve->updateConnectedEditors();
|
||||||
|
@ -1059,6 +1059,7 @@ void RimEclipseView::setEclipseCase(RimEclipseCase* reservoir)
|
|||||||
cellResult()->setEclipseCase(reservoir);
|
cellResult()->setEclipseCase(reservoir);
|
||||||
faultResultSettings()->customFaultResult()->setEclipseCase(reservoir);
|
faultResultSettings()->customFaultResult()->setEclipseCase(reservoir);
|
||||||
|
|
||||||
|
cellEdgeResult()->setEclipseCase(reservoir);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user